Bug 9856 – Unintuitive sizeof evaluation for invalid class declaration
Status
RESOLVED
Resolution
DUPLICATE
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-02T02:03:00Z
Last change time
2013-04-05T04:13:30Z
Keywords
diagnostic
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2013-04-02T02:03:05Z
This sample code comes from bug 4269 (it's already closed):
Code:
----
static if (__traits(compiles, A.sizeof))
{
pragma(msg, "A.sizeof compiles!");
}
class A
{
void foo(B b); // line 7
}
Output:
----
test.d(7): Error: undefined identifier B, did you mean class A?
A.sizeof compiles!
Why pragma declaration inside "static if" is evaluated?
Comment #1 by k.hara.pg — 2013-04-05T04:13:30Z
*** This issue has been marked as a duplicate of issue 9879 ***