Bug 3261 – compiler crash with mixin and forward reference (Issue 402 and 784)

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-08-19T19:09:00Z
Last change time
2015-06-09T01:28:06Z
Keywords
ice-on-invalid-code, patch
Assigned to
nobody
Creator
ktswital
Blocks
340

Comments

Comment #0 by ktswital — 2009-08-19T19:09:52Z
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.
Comment #3 by bugzilla — 2009-10-13T13:46:43Z
Fixed dmd 1.049 and 2.034