traits compiles does not work for symbols from other modules
ag0aep6g via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jul 25 01:30:43 PDT 2017
On 07/24/2017 11:40 PM, Andre Pany wrote:
> m1.d
> -----------------
> module m1;
>
> import m2;
>
> class Foo
> {
> int foo;
> }
>
> void main()
> {
> static assert(__traits(compiles, m1.Foo.foo));
> static assert(__traits(compiles, m2.Bar.bar));
> }
>
> m2.d
> ---------------
> module m2;
>
> class Bar
> {
> int bar;
> }
>
> Why does the second assert throws? What can I use instead of
> __traits(compiles,...) ?
Works for me. What compiler are you using?
More information about the Digitalmars-d-learn
mailing list