[Issue 11864] New: std.variant.Variant doesn't work with CTFE
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jan 3 14:45:15 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11864
Summary: std.variant.Variant doesn't work with CTFE
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: tcdknutson at gmail.com
--- Comment #0 from Dylan Knutson <tcdknutson at gmail.com> 2014-01-03 14:45:12 PST ---
e.g.
---
import std.variant : Variant;
Variant makeVariant(T)(T value)
{
return Variant(value);
}
void main()
{
const a = makeVariant("bar");
pragma(msg, a);
}
---
Results in:
/opt/compilers/dmd2/include/std/variant.d(547): Error: memcpy cannot be
interpreted at compile time, because it has no available source code
/opt/compilers/dmd2/include/std/variant.d(512): called from here:
this.opAssign(value)
/d214/f186.d(6): called from here: (VariantN!(32LU) __ctmp1402 =
VariantN;
, __ctmp1402).this(value)
/d214/f186.d(11): called from here: makeVariant("bar")
/d214/f186.d(12): while evaluating a.init
/d214/f186.d(12): while evaluating pragma(msg, a)
Note that the error doesn't happen if pragma(msg, a) is removed. I guess the
compiler is lazily evaluating 'a'?
--
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