[Issue 17683] New: __traits compiles does not work with package.d

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jul 25 04:45:02 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17683

          Issue ID: 17683
           Summary: __traits compiles does not work with package.d
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: andre at s-e-a-p.de

File m1.d
---------------------------------------

module m1;

import sub;

void main()
{
  import std.traits: fullyQualifiedName;
  mixin(`static assert(__traits(compiles, `~fullyQualifiedName!Bar~`.bar));`);
}


File sub/m2.d
---------------------------------------

module sub.m2;

class Bar
{
    int bar;
}


File sub/package.d
---------------------------------------
module sub;

public import sub.m2;


PS C:\Users\user\Desktop\source> dmd -run m1.d sub/package.d sub/m2.d
m1.d-mixin-9(9): Error: static assert  __traits(compiles, sub.m2.Bar.bar) is
false

While fullyQualifiedName is able to find the symbol Bar, __traits compiles does
not find it. It works if I replace the package.d import with the specific
module m2.d import

Version: DMD32 D Compiler v2.075.0-rc1-master-af3eacf on Windows 10

--


More information about the Digitalmars-d-bugs mailing list