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: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from Adam D. Ruppe <[email protected]> 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: -------

Reply via email to