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.
This is also a D1 regression. It worked on 1.046, fails on 1.047 and later.
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; }
The patch for http://d.puremagic.com/issues/show_bug.cgi?id=4503 also seems to fix this one.
Fixed with 4503
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル