traits compiles does not work for symbols from other modules
Andre Pany via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jul 25 04:34:23 PDT 2017
On Tuesday, 25 July 2017 at 08:30:43 UTC, ag0aep6g wrote:
> Works for me. What compiler are you using?
I reduced the example too lot. The issue is occuring if there is
also a package.d is involved.
m1.d
-----------------------
module m1;
import sub; // Does not throw if replaced with: import sub.m2;
class Foo
{
int foo;
}
void main()
{
static assert(__traits(compiles, m1.Foo.foo));
mixin(`static assert(__traits(compiles, sub.m2.Bar.bar));`);
}
sub/m2.d
----------------------
module sub.m2;
class Bar
{
int bar;
}
sub/package.d
----------------------
module sub;
public import sub.m2;
I use DMD master (as I already need the static foreach) on
windows 10.
DMD32 D Compiler v2.075.0-rc1-master-af3eacf
>> dmd -run m1.d sub/package.d sub/m2.d
Kind regards
André
More information about the Digitalmars-d-learn
mailing list