Thread overview
[Issue 6710] New: Can't use .sizeof in pragma(msg) call
Sep 22, 2011
Andrej Mitrovic
Jan 04, 2012
Andrej Mitrovic
Apr 20, 2012
Andrej Mitrovic
September 22, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6710

           Summary: Can't use .sizeof in pragma(msg) call
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-09-21 20:50:04 PDT ---
struct Foo
{
    static assert(Foo.sizeof == 4);  // ok
    pragma(msg, Foo.sizeof);  // Error: struct test.Foo no size yet for forward
reference

    int x;
}

void main() { }

I'm not sure if it's genuinely a bug, IOW maybe the pragma is evaluated before the compiler does a pass to see which fields the struct is holding?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 04, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6710



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-01-04 06:56:49 PST ---
Workaround: Put the pragma call outside of the structure definition.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6710


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

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


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-04-19 18:48:26 PDT ---
Fixed in 2.059, don't know by which commit though.

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