[Issue 15940] New: std.variant.Variant: compilation fails if a value is aliased struct

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Apr 20 00:19:08 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=15940

          Issue ID: 15940
           Summary: std.variant.Variant: compilation fails if a value is
                    aliased struct
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: goldmax3000 at gmail.com

import std.variant;

class C { }
struct S
{
    C a;
    alias a this;
}
S s = S(new C());
auto v = Variant(s); // compile error


/opt/compilers/dmd2/include/std/traits.d(3636): Error: template instance
std.traits.BaseClassesTuple!(S) does not match template declaration
BaseClassesTuple(T) if (is(T == class))
/opt/compilers/dmd2/include/std/traits.d(4054): Error: template instance
std.traits.TransitiveBaseTypeTuple!(S) error instantiating
/opt/compilers/dmd2/include/std/variant.d(263):        instantiated from here:
ImplicitConversionTargets!(S)
/opt/compilers/dmd2/include/std/variant.d(632):        instantiated from here:
handler!(S)
/opt/compilers/dmd2/include/std/variant.d(548):        instantiated from here:
opAssign!(S)
/d296/f123.d(10):        instantiated from here: __ctor!(S)

--


More information about the Digitalmars-d-bugs mailing list