is(some template instantiation) is true, but the actual instantiation fails

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 29 16:16:21 PST 2016


On 01/29/2016 09:01 AM, Adrian Matoga wrote:

 > Oh, there's more:
 > // this should fail:
 > static assert(is(CallsFoo!NoFoo));
 > // this should fail too:
 > static assert(is(typeof({ alias Baz = CallsFoo!NoFoo; return Baz.init;
 > }())));
 > // and this:
 > static assert(__traits(compiles, { alias Baz = CallsFoo!NoFoo; return
 > Baz.init; }()));
 > // but only this fails:
 > alias Baz = CallsFoo!NoFoo;
 >
 > https://issues.dlang.org/show_bug.cgi?id=15623

As I noted on the bug report, they are work when moved from module scope 
to inside a function (e.g. main()). At least there's that workaround...

Ali



More information about the Digitalmars-d-learn mailing list