4015 – forward reference in alias causes error

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4015 - forward reference in alias causes error
Summary: forward reference in alias causes error
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
Reported: 2010年03月27日 05:32 UTC by Rainer Schuetze
Modified: 2014年02月15日 02:44 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Rainer Schuetze 2010年03月27日 05:32:57 UTC
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 Walter Bright 2010年05月10日 16:10:25 UTC
changelog 482


AltStyle によって変換されたページ (->オリジナル) /