Bug 15670 – std.variant.Variant does not allow classes derived from templated classes

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-02-10T20:51:26Z
Last change time
2019-12-23T09:44:19Z
Assigned to
No Owner
Creator
ZombineDev

Comments

Comment #0 by petar.p.kirov — 2016-02-10T20:51:26Z
The following code does not compile: void main() { import std.variant; class BaseTemplate(T) { this() {} } class Concrete : BaseTemplate!int { this() {} } Algebraic!(Concrete) holder; Concrete a = new Concrete(); holder = Algebraic!Concrete(a); } Error: static assert "Cannot store a Concrete in a VariantN!(8LU, Concrete)" test.d(10): instantiated from here: __ctor!(Concrete)