[Issue 10032] std.traits.moduleName abuse a compiler issue: (parent trait can't evaluate parent object for manifest constants).

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 14 23:31:24 UTC 2019


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

Basile-z <b2.temp at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |b2.temp at gmx.com
         Resolution|---                         |WORKSFORME

--- Comment #2 from Basile-z <b2.temp at gmx.com> ---
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

--


More information about the Digitalmars-d-bugs mailing list