https://issues.dlang.org/show_bug.cgi?id=13204
Jonathan M Davis <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |[email protected] Resolution|--- |INVALID --- Comment #1 from Jonathan M Davis <[email protected]> --- Okay. Think this through. When you declare alias A1 = ABase!1; // L6 it now has to instantiate ABase with 1. When it does that it has to define alias whatever = Foo; Foo is then an alias to A1, which is an alias to ABase!1. So, to determine what Foo is, it has to instantiate ABase!1, which it's already in the middle of doing. It's clearly recursive and isn't going to end. You always have to be _very_ careful when attempting to instantiate a template within itself. You need template constraints or static ifs to fix the problem. So, in this case, you'd probably need to do something like this (untested). struct ABase(uint v) { static if(v == 1) alias whatever = ABase; else alias whatever = Foo; } And as to an improved error message, I don't know what else would help you. It told you the line that where the problem was, and the definition of Foo clearly is attempting to instantiate the template that the error was in. If you can suggest an error message that would be more helpful, that would be great, but as far as I can tell, the compiler is telling you exactly what's wrong. --
