Bug 17683 – __traits compiles does not work with package.d
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-07-25T11:45:00Z
Last change time
2017-07-26T09:54:35Z
Assigned to
nobody
Creator
andre
Comments
Comment #0 by andre — 2017-07-25T11:45:02Z
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
Comment #1 by dlang-bugzilla — 2017-07-26T09:54:35Z
Nothing to do with __traits(compiles).
fullyQualifiedName!Bar expands to "sub.m2.Bar".
That fully qualified names don't work with package modules is issue 11847.
*** This issue has been marked as a duplicate of issue 11847 ***