www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12278] New: __traits(classInstanceSize) returns wrong value if used before class is declared

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

           Summary: __traits(classInstanceSize) returns wrong value if
                    used before class is declared
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: destructionator gmail.com


--- Comment #0 from Adam D. Ruppe <destructionator gmail.com> 2014-02-28
10:21:05 PST ---
class Foo {
    InPlace!Bar inside;
}

class Bar { }

struct InPlace(T) {
        pragma(msg, __traits(classInstanceSize, T));
        private byte[__traits(classInstanceSize, T)] rawData;

        void initializeObject() {
                pragma(msg, __traits(classInstanceSize, T));
        }
}


dmd bug.d
0u
8u


The first one, where the static array is declared, gives 0. The correct value
of 8 is given inside the function.


If you move `class Bar{}` to above Foo's definition, it correctly gives 8 at
both msgs.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 28 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12278


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |thecybershadow gmail.com


--- Comment #1 from Vladimir Panteleev <thecybershadow gmail.com> 2014-03-03
02:15:26 EET ---
https://github.com/D-Programming-Language/dmd/pull/3348

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 02 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12278



--- Comment #2 from github-bugzilla puremagic.com 2014-03-02 19:29:44 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/6557ba3d48ef9e29101c09e52304a3a16c2e81a6
fix Issue 12278 - __traits(classInstanceSize) returns wrong value if used
before class is declared

https://github.com/D-Programming-Language/dmd/commit/9e68f5d3cd9953d34a3944a80faaddbd5f1ef841
Merge pull request #3348 from CyberShadow/fix12278

fix Issue 12278 - __traits(classInstanceSize) returns wrong value if used
before class is declared

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 02 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12278


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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