www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 461] New: Constant not understood to be constant when circular module dependency exists.

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

           Summary: Constant not understood to be constant when circular
                    module dependency exists.
           Product: D
           Version: 0.172
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: digitalmars-com baysmith.com


dmd tmp2.d tmp2b.d
tmp2b.d(6): Integer constant expression expected instead of SIZE
tmp2b.d(6): Integer constant expression expected instead of SIZE

----- tmp2.d -----

private import tmp2b;

const int SIZE = 7;

----- tmp2b.d -----

private import tmp2;

struct s {

    char a[ SIZE ];

}

Workaround:
Move constant above import of other module.

----- tmp2.d -----

const int SIZE = 7;

private import tmp2b;


-- 
Oct 25 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-10-26:
 http://d.puremagic.com/issues/show_bug.cgi?id=461
 dmd tmp2.d tmp2b.d
 tmp2b.d(6): Integer constant expression expected instead of SIZE
 tmp2b.d(6): Integer constant expression expected instead of SIZE

 ----- tmp2.d -----

 private import tmp2b;

 const int SIZE = 7;

 ----- tmp2b.d -----

 private import tmp2;

 struct s {

     char a[ SIZE ];

 }

 Workaround:
 Move constant above import of other module.

 ----- tmp2.d -----

 const int SIZE = 7;

 private import tmp2b;
Added to DStress as http://dstress.kuehne.cn/compile/c/const_40_A.d http://dstress.kuehne.cn/compile/c/const_40_B.d http://dstress.kuehne.cn/compile/c/const_40_C.d http://dstress.kuehne.cn/compile/c/const_40_D.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFUfwbLK5blCcjpWoRAvQeAJ4/cIBgs3KXWqmxmsNNN2lCUhiZIQCgrbm+ nWl9Wy0Jv0MX6ivZkD3TnUk= =0Vc/ -----END PGP SIGNATURE-----
Nov 08 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=461


Rainer Schuetze <r.sagitario gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |r.sagitario gmx.de



PDT ---
Semantics is not yet run on the SIZE identifier, so dmd does not know, it is
const. The patch invokes semantics if not yet run.

Index: optimize.c
===================================================================
--- optimize.c    (revision 421)
+++ optimize.c    (working copy)
   -47,6 +47,8   
     Expression *e = NULL;
     if (!v)
     return e;
+    if (!v->originalType && v->scope) // semantic() not yet run - BUG 461
+    v->semantic (v->scope);

     if (v->isConst() || v->isImmutable() || v->storage_class & STCmanifest)
     {

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


Walter Bright <bugzilla digitalmars.com> changed:

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



14:18:37 PDT ---
changeset 480

-- 
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=461


Don <clugdbug yahoo.com.au> changed:

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



Fixed DMD1.061 and DMD2.046.

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