Bug 4015 – forward reference in alias causes error

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-03-27T05:32:00Z
Last change time
2014-02-15T02:44:17Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
r.sagitario

Comments

Comment #0 by r.sagitario — 2010-03-27T05:32:57Z
The code alias A B; const int A = 1; causes error test.d(1): Error: alias test.B forward reference of A This is caused by dmd not trusting it's forward reference capabilities and issuing the error without even trying: Index: declaration.c =================================================================== --- declaration.c (revision 421) +++ declaration.c (working copy) @@ -500,7 +500,7 @@ //printf("alias is a symbol %s %s\n", s->kind(), s->toChars()); type = NULL; VarDeclaration *v = s->isVarDeclaration(); - if (v && v->linkage == LINKdefault) + if (0) { error("forward reference of %s", v->toChars()); s = NULL; (I thought this would be a duplicate, but the patch does not apply to any other bug i've tried).
Comment #1 by bugzilla — 2010-05-10T16:10:25Z
changelog 482