[Issue 8654] New: cannot take address of function which is 1)overloaded, 2) templated, and 3) member (static or not): Error: xxx is not an lvalue
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Sep 13 17:58:30 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8654
Summary: cannot take address of function which is 1)overloaded,
2) templated, and 3) member (static or not): Error:
xxx is not an lvalue
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: thelastmammoth at gmail.com
--- Comment #0 from thelastmammoth at gmail.com 2012-09-13 17:58:46 PDT ---
here's my other weird example, which I managed to simplify to as follows.
Basically if:
1) the function is overloaded, and
2) it is a template, and
3) it is a member function (either static or nonstatic)
Then you get a CT error that looks like: Error: (A).fun!(2) is not an lvalue
That's a bug too right? (but different!)
I wish delegates were more 1st class citizens and behaved...
----
void run(Fun)(Fun fun){
}
class A {
void fun1(int T)() if(T==2) { }
void fun2(int T)() if(T==1) { }
void fun2(int T)() if(T==2) { }
void fun3(){}
void fun3(int x){}
void fun4(int T)() if(T==1) { }
void fun4(int T)(int x) if(T==2) { }
void fun5(T)() { }
void fun5(T)(int x) { }
static void fun6(int T)() if(T==1) { }
static void fun6(int T)() if(T==2) { }
}
void fun7(int T)() if(T==1) { }
void fun7(int T)() if(T==2) { }
void main(){
auto a=new A;
run(&a.fun1!2); //works
//run(&a.fun2!2); //CT Error: a.fun2!(2) is not an lvalue
run(&a.fun3); //works
//run(&a.fun4!2); //CT Error: a.fun4!(2) is not an lvalue
//run(&a.fun5!double); //CT Error: a.fun5!(double) is not an lvalue
//run(&A.fun6!2); //CT Error: (A).fun6!(2) is not an lvalue
run(&fun7!2); //works
}
----
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list