Bug 7123 – static assert(is(typeof(toDelegate(&main)))) is false

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-12-17T00:24:00Z
Last change time
2011-12-18T20:22:23Z
Keywords
patch, wrong-code
Assigned to
nobody
Creator
zan77137

Comments

Comment #0 by zan77137 — 2011-12-17T00:24:30Z
This code should be compilable. import std.functional; void main() { version(Workaround) typeof(toDelegate(&main)) dgDummy; // <- Code is compilable if this line is enabled. static assert(is(typeof(toDelegate(&main)))); // NG: false }
Comment #1 by k.hara.pg — 2011-12-17T04:12:01Z
Reduced test case: private struct DelegateFaker(F) { template GeneratingPolicy() {} enum WITH_BASE_CLASS = __traits(hasMember, GeneratingPolicy!(), "x"); } auto toDelegate(F)(F fp) { alias DelegateFaker!F Faker; } void main() { version(pass) { pragma(msg, typeof(toDelegate(&main))); static assert(is(typeof(toDelegate(&main)))); } else { static assert(is(typeof(toDelegate(&main)))); } }
Comment #2 by k.hara.pg — 2011-12-17T04:46:16Z
Comment #3 by bugzilla — 2011-12-18T20:22:23Z