Comment #0 by default_357-line — 2023-08-17T14:10:34Z
Given this code:
```
void fun()
{
enum e = __traits(compiles, templateFun());
Foo!() a;
a.bar.baz();
}
struct Foo() { Bar!() bar; }
void templateFun()() { Foo!(); }
struct Bar()
{
void baz()() { }
void erroring() { BREAK_SEMA; }
}
```
DMD says "Error: unknown, please file report on issues.dlang.org".
Somehow the particular ordering of __traits(compiles) swallows the "undefined identifier BREAK_SEMA" error with no sign.
Comment #1 by razvan.nitu1305 — 2023-08-18T09:53:28Z
I bet this is a dupe of: https://issues.dlang.org/show_bug.cgi?id=15459 .
Bottom line: template instances that are instantiated from speculative contexts will be cached (without any errors being outputted). Once the template instance is reused, boom!
For more info check my failed attempt at fixing this: https://github.com/dlang/dmd/pull/13359
Comment #2 by robert.schadek — 2024-12-13T19:30:26Z