D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6568 - access qualifiers and delegate template parameter
Summary: access qualifiers and delegate template parameter
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-28 09:37 UTC by zeljkog
Modified: 2014-11-18 04:51 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description zeljkog 2011-08-28 09:37:51 UTC
import std.stdio;

struct S(alias Fun){
// public:	// uncomment to break compilation
	int x;
	void f() {
		writefln("%s, %d", Fun()? "yes":"no", x);
	}
}

void f1(int a, int b){
	auto s = S!({ return a < b; })(3);
	s.f();
}

void main(){
	f1(10, 20);
}
This compiles and works as expected.
But as soon as I added any access qualifier (even one redundant 'public:') to structure S, compilation breaks with message:

bug001.d(9): Error: function bug01.f1.S!(delegate nothrow bool()

{

return a < b;

}

).S.f cannot get frame pointer to __dgliteral1
Comment 1 SomeDude 2012-04-27 10:10:31 UTC
Also fails on 2.059 Win32
Comment 2 hsteoh 2014-11-18 04:51:04 UTC
Seems to work on git HEAD. Tested on Linux/64. Please reopen if problem reoccurs.