Bug 24089 – Error: Unknown for bad ordering of struct/function instantiation with sema error

Status
NEW
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2023-08-17T14:10:34Z
Last change time
2024-12-13T19:30:26Z
Keywords
industry
Assigned to
No Owner
Creator
FeepingCreature
Moved to GitHub: dmd#20321 →

Comments

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
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20321 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB