[Issue 19605] enum X: "Error: enum X is forward referenced when looking for sizeof"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 7 21:40:45 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=19605

Tiberiu Lepadatu <tiberiulepadatu14 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tiberiulepadatu14 at gmail.com

--- Comment #1 from Tiberiu Lepadatu <tiberiulepadatu14 at gmail.com> ---
(In reply to elpenguino+D from comment #0)
> Very easy to reproduce:
> ```
> enum X;
> static assert(X.sizeof == 0);
> ```
> 
> Note that I'm not exactly sure what the size of this should be. My guess was
> 0, but DMD 2.064 seems to manage to evaluate it to 4 despite still issuing
> the same 

It is 4 because it is the same as sizeof int.
I will look into the error.

[1] https://dlang.org/spec/enum.html

--


More information about the Digitalmars-d-bugs mailing list