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
Comment #1 by k.hara.pg — 2013-04-04T06:03:14Z
Comment #2 by github-bugzilla — 2013-04-07T05:26:20Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a61b4a4ee539d137db69a6d2c7e2557f81e96b5b fix Issue 9874 - Function call syntax disuniformity in template constraints https://github.com/D-Programming-Language/dmd/commit/1afa14822650f02a608cecda4a5c53cdb219a7a3 Merge pull request #1837 from 9rnsr/fix9874 Issue 9874 - Function call syntax disuniformity in template constraints