Bug 6994 – Using explicit 'this' in template constraint causes an error

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-11-23T00:29:00Z
Last change time
2011-11-24T00:01:28Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2011-11-23T00:29:54Z
struct Foo { T get(T)(){ return T.init; } T func1(T)() if (__traits(compiles, get!T())) { return get!T; } T func2(T)() if (__traits(compiles, this.get!T())) // add explicit 'this' { return get!T; } } void main() { Foo foo; foo.get!int(); // OK foo.func1!int(); // OK foo.func2!int(); // NG }
Comment #1 by k.hara.pg — 2011-11-23T05:31:52Z
Comment #2 by bugzilla — 2011-11-24T00:01:28Z