[Issue 18569] New: std.traits.moduleName problem with enum
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Mar 7 15:06:28 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18569
Issue ID: 18569
Summary: std.traits.moduleName problem with enum
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: minor
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: claudemr at live.fr
How to reproduce the issue, 2 files containing the same code, only the module
name changes.
aa.d:
module aa;
import std.traits : moduleName;
private enum stuff = 0;
pragma(msg, moduleName!stuff);
bb.d:
module bb;
import std.traits : moduleName;
private enum stuff = 0;
pragma(msg, moduleName!stuff);
Command line:
dmd aa.d bb.d -main
Output of the command line:
aa
aa
Whereas I would expect:
aa
bb
-------------
Replacing:
private enum stuff = 0;
with:
private int stuff = 0;
gives a proper result.
Replacing:
private struct stuff { };
with:
private struct stuff { };
also gives a proper result.
It does not look like it comes from the "parent" traits, as using:
private enum stuff = 0;
pragma(msg, __traits(parent, stuff).stringof[7..$]);
also gives a proper result.
--
More information about the Digitalmars-d-bugs
mailing list