www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - foo is not an lvalue

reply Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
void main() {
     foo!();
}

template foo( ) {
     void foo() {
         auto a = (&foo);
     }
}

dmd from master (a few days ago) gives:

  Error: foo()() is not an lvalue


wut?
Apr 17 2013
parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Ellery Newcomer:

 dmd from master (a few days ago) gives:

  Error: foo()() is not an lvalue


 wut?
I think you need to write: auto a = &foo!(); Bye, bearophile
Apr 17 2013
parent Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
On 04/17/2013 06:02 PM, bearophile wrote:
 Ellery Newcomer:

 dmd from master (a few days ago) gives:

  Error: foo()() is not an lvalue


 wut?
I think you need to write: auto a = &foo!(); Bye, bearophile
wouldn't that be infinitely recursing template instantiation?
Apr 17 2013