Bug 3679 – Regression(2.031) template forward reference regression

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2010-01-05T20:25:00Z
Last change time
2014-04-18T09:12:02Z
Keywords
rejects-valid
Assigned to
nobody
Creator
2korden
Depends on
4503

Comments

Comment #0 by 2korden — 2010-01-05T20:25:12Z
Test case: module test; public class Derived : public Base { } class Template(T) { } alias Template!(bool) TemplateAlias; class Base { TemplateAlias templateAlias; } # dmd test.d test.d(13): Error: forward reference to 'Template!(bool)' test.d(13): Error: TemplateAlias is used as a type test.d(13): Error: variable test.Base.templateAlias voids have no value Regression since DMD2.031, blocker for me to upgrate to a newer compiler version.
Comment #1 by clugdbug — 2010-01-24T23:58:37Z
This is also a D1 regression. It worked on 1.046, fails on 1.047 and later.
Comment #2 by clugdbug — 2010-01-25T02:07:38Z
The regression was caused by adding a couple of lines to ClassDeclaration::semantic(Scope *sc) in class.c in D1.047. I think this was probably part of the fix for bug 3170. Currently line 350 in the D1 source, commenting out the two lines marked '-' allows this test case to compile again. I think the bug lies elsewhere, however. ========= if (!tc->sym->symtab || tc->sym->scope || tc->sym->sizeok == 0) { //printf("%s: forward reference of base class %s\n", toChars(), tc->sym->toChars()); //error("forward reference of base class %s", baseClass->toChars()); // Forward reference of base class, try again later //printf("\ttry later, forward reference of base class %s\n", tc->sym->toChars()); scope = scx ? scx : new Scope(*sc); scope->setNoFree(); - if (tc->sym->scope) - tc->sym->scope->module->addDeferredSemantic(tc->sym); scope->module->addDeferredSemantic(this); return; }
Comment #3 by hoganmeier — 2010-07-27T10:15:04Z
The patch for http://d.puremagic.com/issues/show_bug.cgi?id=4503 also seems to fix this one.
Comment #4 by bugzilla — 2010-08-08T21:35:10Z
Fixed with 4503