[Issue 6893] Write of enum member represented with ubyte or ulong

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 22 18:08:24 PDT 2013


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



--- Comment #6 from hsteoh at quickfur.ath.cx 2013-08-22 18:08:22 PDT ---
Argh. I wish bugzilla allowed editing of comments... What I meant was:
getNthInt is called from inside a *runtime* if-condition that evaluates to
false when the spec is "%s" and the argument is a ulong enum, but since this
if-condition can only be checked at runtime, getNthInt must be able to compile
in that case. Currently it doesn't compile because it assumes isIntegral!T
means T can be implicitly converted to int, which is not true if the argument
is a ulong (or a ulong enum). So the fix is to replace isIntegral with
is(typeof(to!int(...))) so that at compile-time the compiler will hardcode the
function to throw an exception when an invalid argument is given. (It won't
actually throw at runtime if the if-condition in the caller evaluates to false
at runtime.)

-- 
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