[Issue 11864] std.variant.Variant doesn't work with CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 14 03:29:30 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=11864


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


--- Comment #1 from Don <clugdbug at yahoo.com.au> 2014-01-14 03:29:27 PST ---
> Note that the error doesn't happen if pragma(msg, a) is removed. I guess the
compiler is lazily evaluating 'a'?

No, 'a' is normally just a run-time value. By putting it in a pragma(msg),
you're asking the compiler to evaluate it at compile time. This fails because
Variant uses memcpy. This isn't a bug. Replacing the memcpy with an array slice
assignment would just cause it to fail in a different way.

Variants are intrinsically a bit nasty, they're basically a union, so there's
actually multiple reasons why they don't work in CTFE.

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


More information about the Digitalmars-d-bugs mailing list