D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15940 - ImplicitConversionTargets and class alias in struct
Summary: ImplicitConversionTargets and class alias in struct
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2016-04-20 07:19 UTC by GoldMax
Modified: 2020-03-21 03:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description GoldMax 2016-04-20 07:19:08 UTC
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)
Comment 1 basile-z 2016-05-21 18:29:48 UTC
this is a easy-to-fix-bug in std.traits.ImplicitConversionTargets, I take.
Comment 2 basile-z 2016-06-02 13:01:42 UTC
https://github.com/dlang/phobos/pull/4342
Comment 3 Dlang Bot 2019-12-10 14:33:44 UTC
@berni44 created dlang/phobos pull request #7313 "Fix Issue 15940 - ImplicitConversionTargets and class alias in struct" fixing this issue:

- Fix Issue 15940 - ImplicitConversionTargets and class alias in struct

https://github.com/dlang/phobos/pull/7313
Comment 4 Dlang Bot 2019-12-12 16:49:38 UTC
dlang/phobos pull request #7313 "Fix Issue 15940 - ImplicitConversionTargets and class alias in struct" was merged into master:

- 2584fd837f700bf3bf08071162390d02af0341af by Bernhard Seckinger:
  Fix Issue 15940 - ImplicitConversionTargets and class alias in struct

https://github.com/dlang/phobos/pull/7313