this is slightly different code from Issue 402 and Issue 784, but it causes the compiler to freeze in DMD 1.046 and 2.032:
> dmd -c Conflicts.d
Conflicts.d(12): Error: mixin Conflicts.foo.BadImpl!(uint,Mix1) cannot resolve forward reference
Conflicts.d(12): Error: mixin Conflicts.foo.BadImpl!(uint,Mix1) cannot resolve forward reference
--- Conflicts.d ----
template BadImpl(T, alias thename)
{
void a_bad_idea(T t)
{
thename.a_bad_idea(t);
}
}
class foo
{
mixin BadImpl!(uint,Mix1) Mix1;
}
int main()
{
return 0;
}
Comment #1 by clugdbug — 2009-08-25T02:30:46Z
Here's a superficial patch. If an error occurs while determining the arguments, it shouldn't try to determine which template is intended.
Patch: template.c, line 4542.
--------
// Run semantic on each argument, place results in tiargs[]
+ int olderrors = global.errors;
semanticTiargs(sc);
+ if (global.errors != olderrors) return; // Quit immediately if error occurs in argument
tempdecl = findBestMatch(sc);
if (!tempdecl)
{ inst = this;
return; // error recovery
}
Comment #2 by smjg — 2009-08-25T11:29:12Z
I guess this counts as an actual forward reference bug, given that Mix1 is kind-of a forward reference....
(This seems to be a variation of CRTP.)
(In reply to comment #0)
> this is slightly different code from Issue 402 and Issue 784, but
> it causes the compiler to freeze in DMD 1.046 and 2.032:
Uh, 2.032 doesn't seem to have been released yet.