[Issue 17987] New: Cannot use string in Variant at compile time
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Fri Nov 17 12:21:27 UTC 2017
    
    
  
https://issues.dlang.org/show_bug.cgi?id=17987
          Issue ID: 17987
           Summary: Cannot use string in Variant at compile time
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: issues.dlang at jmdavisProg.com
This code
==========
import std.variant;
Variant v = "hello";
void main()
{
}
==========
results in this error:
/usr/local/include/dmd/std/variant.d(624): Error: memcpy cannot be interpreted
at compile time, because it has no available source code
/usr/local/include/dmd/std/variant.d(559):        called from here:
this.opAssign(value)
q.d(3):        called from here: VariantN(& handler, cast(ubyte)0u,
).this("hello")
I would _think_ that it could be made to work without memcpy, but I don't know.
Regardless, the use of memcpy restricts the ability to use Variant at compile
time. So ideally, Variant would be fixed so that the example here worked.
--
    
    
More information about the Digitalmars-d-bugs
mailing list