www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4015] New: forward reference in alias causes error

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: r.sagitario gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario 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: -------
Mar 27 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4015


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2010-05-10
16:10:25 PDT ---
changelog 482

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