www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4016] New: const initializer cannot forward reference other const initializer

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4016

           Summary: const initializer cannot forward reference other const
                    initializer
           Product: D
           Version: 2.041
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: patch, rejects-valid
          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:45:37
PDT ---
comipiling

----
const PM_QS_INPUT =         QS_INPUT;
const QS_INPUT =           2;
----

produces:
test.d(1): Error: forward reference of variable QS_INPUT

Here's a patch:

Index: expression.c
===================================================================
--- expression.c    (revision 421)
+++ expression.c    (working copy)
   -2395,7 +2395,9   
     {
     //printf("Identifier '%s' is a variable, type '%s'\n", toChars(),
v->type->toChars());
     if (!type)
-    {   type = v->type;
+    {   if (!v->type && v->scope)
+        v->semantic(v->scope);
+        type = v->type;
         if (!v->type)
         {    error("forward reference of %s %s", v->kind(), v->toChars());
         type = Type::terror;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 27 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4016


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2010-05-10
15:13:04 PDT ---
changeset 481

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 10 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4016


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED


--- Comment #2 from Don <clugdbug yahoo.com.au> 2010-05-18 12:17:54 PDT ---
Fixed DMD2.046.

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