Bug 21049 – template inside template causes internal compile error

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-07-17T19:25:06Z
Last change time
2024-12-13T19:10:11Z
Assigned to
No Owner
Creator
cy
Moved to GitHub: dmd#19748 →

Attachments

IDFilenameSummaryContent-TypeSize
1798app.dAn example that causes the error.text/x-dsrc260
1799file_21049.txtThe compiler error backtracetext/plain2981

Comments

Comment #0 by dlang — 2020-07-17T19:25:06Z
Created attachment 1798 An example that causes the error. I think I tricked the compiler into trying to use two contexts in a template, or something. I was making a thing that would be like prepare!(type, "foo", args...).fire!(sometypes...), then for each type it would fire type().foo(args...). And it died the death, so I started simplifying it, until I discarded the variadicness, the types, the arguments, the functions, and everything except a template inside a template, pretty much. There is no error in my code if I use an rvalue or literal like 42. There is no error if I use a global variable defined outside the function. But if I use a local variable like "derp" it dies with an internal compiler error. Even if I have a version block preventing it from being compiled, it still kills the compiler. Even if the variable is outright immutable.
Comment #1 by dlang — 2020-07-17T19:26:17Z
Created attachment 1799 The compiler error backtrace
Comment #2 by robert.schadek — 2024-12-13T19:10:11Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19748 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB