Bug 7070 – can't assign null to Variant

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-12-06T04:19:00Z
Last change time
2011-12-13T07:50:45Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
hoganmeier

Comments

Comment #0 by hoganmeier — 2011-12-06T04:19:43Z
If it isn't supposed to work anymore, just close the report. import std.variant; void main() { Variant v; v = null; } $ dmd test.d /std/traits.d(1755): Error: static assert "argument is not a class or interface" /std/traits.d(1818): instantiated from here: BaseTypeTuple!(typeof(null)) /std/traits.d(1933): instantiated from here: BaseClassesTuple!(typeof(null)) /std/traits.d(2230): instantiated from here: TransitiveBaseTypeTuple!(typeof(null)) /std/variant.d(255): instantiated from here: ImplicitConversionTargets!(typeof(null)) /std/variant.d(543): instantiated from here: handler!(typeof(null)) test.d(6): instantiated from here: opAssign!(typeof(null))
Comment #1 by k.hara.pg — 2011-12-09T02:51:56Z
2.057head changes the type of null literal from void* to typeof(null). But std.variant yet not support it. Workaround: import std.variant; void main() { Variant v; //v = null; v = (void*).init; }
Comment #2 by k.hara.pg — 2011-12-09T19:28:25Z
Comment #3 by k.hara.pg — 2011-12-13T07:50:45Z