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



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



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



Fixed DMD2.046.

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