digitalmars.D.bugs - [Issue 8653] New: cannot take address of auto-return function declared in outside module: "Error: forward reference"
- d-bugmail puremagic.com (74/74) Sep 13 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8653
- d-bugmail puremagic.com (13/13) Sep 15 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8653
http://d.puremagic.com/issues/show_bug.cgi?id=8653 Summary: cannot take address of auto-return function declared in outside module: "Error: forward reference" Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: thelastmammoth gmail.com --- Comment #0 from thelastmammoth gmail.com 2012-09-13 17:56:27 PDT --- See the following code for CT error. It seems we cannot take address of auto-return function declared in outside module, but we can if it's declared in the same module. The CT error is: "Error: forward reference" file main.d: ---- import fun; void run3(Fun,T...)(Fun fun,T args){ fun(args); } class A1{ void fun1(double x){ } double fun2(double x){ return x; } auto fun3(double x){ return x; } auto fun4(double x){ } } void main(){ test1; test2; } void test1(){ auto a=new A1; run3(&a.fun1,1); run3(&a.fun2,1); run3(&a.fun3,1); run3(&a.fun4,1); } void test2(){ auto a=new A2; run3(&a.fun1,1); run3(&a.fun2,1); run3(&a.fun3,1);//CT error run3(&a.fun4,1);//CT error } ----- file fun.d: ---- module fun; class A2{ void fun1(double x){ } double fun2(double x){ return x; } auto fun3(double x){ return x; } auto fun4(double x){ } } ---- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 13 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8653 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2012-09-15 06:42:01 PDT --- This is a dup of bug 5933. I've already posted a pull request for that, but not yet merged. *** This issue has been marked as a duplicate of issue 5933 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 15 2012