Issue 7538 - All kinds of property functions should be called before getting their types inside typeof#2123
Conversation
|
@andralex, this is contrary to a part of DIP24, but I think it is necessary. In DIP24, you proposed that Currently However, if the So I think we should continue current behavior. This change does it more strictly. |
|
This seems like an odd special case to me to support. A template function with parameters is called as Now transporting that to parameter-less template functions, we ordinarily call them with I am not sure I understand the argument around So I guess I'm confused... |
|
The core issue in bug 7538 is that current typeof checks only non-template Current compiler behaves as follows. // non-template functions
long nfunc1() { return 1; }
void nfunc2(long) { }
pragma(msg, typeof(nfunc1)); // prints 'long()'
pragma(msg, typeof(nfunc2)); // prints 'void(long)'For non-template normal functins, @property long nprop1() { return 1; }
@property void nprop2(long) { }
pragma(msg, typeof(nprop1)); // prints 'long'
pragma(msg, typeof(nprop2)); // errorFor non-template getter property function, typeof yields its return type. Then, Up to this point, each of them expected? OK. Let's see template cases. // template functions
long tfunc1()() { return 1; }
void tfunc2(T)(T) { }
pragma(msg, typeof(tfunc1)); // prints 'void'
pragma(msg, typeof(tfunc2)); // prints 'void'For template normal functins, @property long tprop1()() { return 1; }
@property void tprop2(T)(T) { }
pragma(msg, typeof(tprop1)); // prints void - inconsistent with nprop1
pragma(msg, typeof(tprop2)); // prints void - inconsistent with nprop2Finally, for template I think the last case: Any opinions about this? |
…ore getting their types inside typeof
Issue 7538 - All kinds of property functions should be called before getting their types inside typeof
|
Thanks, @WalterBright . This change has been a basis for both #2130 and #2305. |
http://d.puremagic.com/issues/show_bug.cgi?id=7538