Bug 7275 – Cannot use property function call in case/case range statement
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-01-11T19:59:00Z
Last change time
2012-10-07T11:52:45Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2012-01-11T19:59:04Z
Property function call in case/case range statement doesn't work well.
Example:
----
void main()
{
@property int bar1(){ return 0; }
@property int bar2(){ return 1; }
@property int bar3(){ return 2; }
switch (0){
case bar1: break; // Line 8
case bar2: .. // Line 9
case bar3: break; // Line 10
default: break;
}
}
Output:
----
test.d(8): Error: cannot implicitly convert expression (bar1) of type @property int() to int
test.d(9): Error: cannot implicitly convert expression (bar2) of type @property int() to int
test.d(10): Error: cannot implicitly convert expression (bar3) of type @property int() to int