Bug 9874 – Function call syntax disuniformity in template constraints
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-04T05:02:00Z
Last change time
2013-04-07T05:26:46Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2013-04-04T05:02:04Z
It seems inside the template constraints functions must be called with a trailing (), unlike from other functions:
bool foo() {
return true;
}
void bar1(T)(T) if (foo()) {} // OK
void bar2(T)(T) if (foo) {} // error
void main() {
foo; // OK
bar1(0);
bar2(0);
}
dmd 2.063alpha gives:
temp.d(5): Error: constraint foo is not constant or does not evaluate to a bool