auto x = property: variable x cannot be declared to be a function
    Lionello Lunesu 
    lio at lunesu.remove.com
       
    Fri Nov 24 03:50:42 PST 2006
    
    
  
When converting a (public) variable into a property (get/set) I suddenly 
got the compiler error mentioned in the subject.
The following code is a minimal test case:
#int prop() { return 0; }
#void main() {
#  auto x = prop;
#}
A workaround is to drop the "auto" and use the actual type: int x = prop;
or to to add an extra pair of (): auto x = prop();
I understand that "prop" is a function and therefor "auto" defers it as 
such and then fails to declare a variable of that type (which is why I'm 
posting it here, instead of in BugZilla.)
Would it break anything to treat this case such that a property behaves 
more like a variable, meaning that the type deferred would be the return 
type of the getter?
L.
    
    
More information about the Digitalmars-d-bugs
mailing list