[Issue 11101] Invalid enum member overflow message

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 23 10:02:41 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11101



--- Comment #4 from Mike Wey <mike-wey at planet.nl> 2013-09-23 10:02:39 PDT ---
(In reply to comment #3)
> It should fail to compile with NONE larger than 110.
> 
> The algorithm is if GTokenType.LAST==GTokenType.max, then attempting to
> calculate GTokenType.LAST+1 overflows it.

110 succeeds 111 fails in both cases GTokenType.LAST==GTokenType.max, both
cases should either fail or succeed.
Also note that when part of gtkD the enum overflows when NONE is 87, as far as
i can tell this depends on the size of the GtkRcTokenType enum.

This seems a bit inconsistent.

> To get what you are looking for, use:
> 
> enum GtkRcTokenType
> {
>     INVALID = GTokenType.LAST + 1,
>     INCLUDE,
> }
> 
> which will compile successfully.

I'm casting GTokenType.LAST to int because the values of the enum need to
correspond with there C counter part.

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


More information about the Digitalmars-d-bugs mailing list