[Issue 21235] New: Undefined reference with circular opEquals between two templates, one of which has an error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 10 13:41:13 UTC 2020


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

          Issue ID: 21235
           Summary: Undefined reference with circular opEquals between two
                    templates, one of which has an error
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: default_357-line at yahoo.de

Consider the following code:

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

struct Helper {
    bool opEquals()(Helper) {
        static assert(false); // trigger some error here
        Template().opEquals(Template()); // circle back around
    }
}

void main() { }
```

With every DMD version **since 2.063**, and also git at v2.093.1-551-gec431149f
(master of 2020-09-10), this produces a linker error on simple compilation.

https://run.dlang.io/is/tiCXc4

--


More information about the Digitalmars-d-bugs mailing list