Bug 6710 – Can't use .sizeof in pragma(msg) call

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-09-21T20:50:00Z
Last change time
2012-04-19T18:48:26Z
Keywords
rejects-valid
Assigned to
nobody
Creator
andrej.mitrovich
Blocks
340

Comments

Comment #0 by andrej.mitrovich — 2011-09-21T20:50:04Z
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?
Comment #1 by andrej.mitrovich — 2012-01-04T06:56:49Z
Workaround: Put the pragma call outside of the structure definition.
Comment #2 by andrej.mitrovich — 2012-04-19T18:48:26Z
Fixed in 2.059, don't know by which commit though.