Bug 9879 – Built-in sizeof should return ErrorExp if error occurs in aggregate type semantics

Status
RESOLVED
Resolution
INVALID
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-04T21:12:00Z
Last change time
2013-04-05T04:13:30Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2013-04-04T21:12:54Z
From bug 4269: With this code, `__traits` should return `false`, but doesn't. static if (__traits(compiles,A.sizeof)) pragma(msg, "A.sizeof compiles!"); class A { void foo(B b); }
Comment #1 by k.hara.pg — 2013-04-04T21:19:38Z
Comment #2 by clugdbug — 2013-04-05T03:58:02Z
This behaviour is intentional. Although there is an error in a function declared in A, the size of A is still known. Just as an error inside a function definition doesn't make the type of the function unknown.
Comment #3 by k.hara.pg — 2013-04-05T04:12:03Z
(In reply to comment #2) > This behaviour is intentional. > > Although there is an error in a function declared in A, the size of A is still > known. > > Just as an error inside a function definition doesn't make the type of the > function unknown. OK, It makes sense. Thanks.
Comment #4 by k.hara.pg — 2013-04-05T04:13:30Z
*** Issue 9856 has been marked as a duplicate of this issue. ***