www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21049] New: template inside template causes internal compile


          Issue ID: 21049
           Summary: template inside template causes internal compile error
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dlang verge.info.tm

Created attachment 1798
  --> https://issues.dlang.org/attachment.cgi?id=1798&action=edit
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.

Jul 17 2020