http://d.puremagic.com/issues/show_bug.cgi?id=4015

           Summary: forward reference in alias causes error
           Product: D
           Version: 2.041
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: r.sagita...@gmx.de


--- Comment #0 from Rainer Schuetze <r.sagita...@gmx.de> 2010-03-27 05:32:57 
PDT ---
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).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to