Bug 10032 – std.traits.moduleName abuse a compiler issue: (parent trait can't evaluate parent object for manifest constants).
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-05T10:59:50Z
Last change time
2020-03-21T03:56:40Z
Assigned to
No Owner
Creator
Igor Stepanov
Comments
Comment #0 by wazar.leollone — 2013-05-05T10:59:50Z
Comment #1 by bugzilla — 2019-11-14T12:41:07Z
Can you explain this a little bit more?
There have now passed about 6 years and it looks to me like no problems appeared here...
Comment #2 by b2.temp — 2019-11-14T23:31:24Z
There was a bug but it's fixed since 2.063,
the following code with "all compilers" on run.dlang.io confirms:
---
module no_bug_here;
import std.traits: moduleName;
struct S
{
enum se = 8;
static assert(moduleName!se == "no_bug_here");
struct I
{
enum ise = 8;
static assert(moduleName!ise == "no_bug_here");
}
}
void main(string[] args)
{
enum le = 8;
static assert(moduleName!le == "no_bug_here");
}
---
> Up to 2.060 : Failure with output:
-----
/path/to/dmd/dmd2/linux/bin64/../../src/phobos/std/traits.d(198): Error: argument 8 has no parent
/path/to/dmd/dmd2/linux/bin64/../../src/phobos/std/traits.d(198): Error: argument false has no parent
/path/to/dmd/dmd2/linux/bin64/../../src/phobos/std/traits.d(198): Error: alias std.traits.moduleName!(false).moduleName recursive alias declaration
/path/to/dmd/dmd2/linux/bin64/../../src/phobos/std/traits.d(198): Error: template instance std.traits.moduleName!(false) error instantiating
onlineapp.d(8): instantiated from here: moduleName!(8)
onlineapp.d(8): Error: template instance std.traits.moduleName!(8) error instantiating
-----
2.061 to 2.062 : Failure with output:
-----
/path/to/dmd/dmd2/linux/bin64/../../src/phobos/std/traits.d(214): Error: argument 8 has no parent
/path/to/dmd/dmd2/linux/bin64/../../src/phobos/std/traits.d(214): Error: argument false has no parent
/path/to/dmd/dmd2/linux/bin64/../../src/phobos/std/traits.d(214): Error: alias std.traits.moduleName!(false).moduleName recursive alias declaration
/path/to/dmd/dmd2/linux/bin64/../../src/phobos/std/traits.d(214): Error: template instance std.traits.moduleName!(false) error instantiating
onlineapp.d(8): instantiated from here: moduleName!(8)
onlineapp.d(8): Error: template instance std.traits.moduleName!(8) error instantiating
-----
Since 2.063 : Success and no output