[Issue 19091] __traits(compiles) and error in templated structs leads to missing symbol

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 14 09:21:59 UTC 2020


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

--- Comment #6 from FeepingCreature <default_357-line at yahoo.de> ---
Update: version that makes it clearer what happens:

```
struct Template {
    void opEquals(U, this TA)(U) {
        pragma(msg, "Template.opEquals!(" ~ U.stringof ~ ", " ~ TA.stringof ~
")");
        foo();
    }
}

void foo()() {
    static assert(false); // foo() fails xeq semantic3 while gagged
    bar!();
}

// this is the symbol that sticks around and references foo().
// Despite foo() erroring, bar() is not errored and emits normally.
void bar()() {
    pragma(msg, "bar()");
    foo();
}

void main() { }
```

--


More information about the Digitalmars-d-bugs mailing list