Bug 10879 – std.variant Variant/Algebraic: Can't store static arrays > 32(/16) bytes

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-08-24T06:13:56Z
Last change time
2018-01-31T06:03:51Z
Assigned to
No Owner
Creator
Johannes Pfau

Comments

Comment #0 by johannespfau — 2013-08-24T06:13:56Z
Test case: --------- import std.variant; void main() { Variant v; v = cast(int[10]) [1,2,3,4,5,6,7,8,9,10]; } --------- http://dpaste.dzfl.pl/b3f532c0 std/variant.d(551): Error: new can only create structs, dynamic arrays or class objects, not int[10LU]'s There's an unit test in std.variant which tests static arrays of 5 elements. This test fails on ARM as variant can only store 16 bytes (creal.sizeof) on ARM, not 20.
Comment #1 by dmitry.olsh — 2014-06-06T08:37:58Z
Still doesn't work. The lines have changed: std\variant.d(606): Error: new can only create structs, dynamic arrays or class objects, not int[10]'s std\variant.d(356): Error: new can only create structs, dynamic arrays or class objects, not int[10]'s std\variant.d(611): Error: template instance std.variant.VariantN!(20u).VariantN.handler!(int[10]) error instantiating ...
Comment #2 by simen.kjaras — 2016-04-16T13:43:15Z
https://github.com/dlang/phobos/pull/4204 This fixes the problem in Phobos. One could certainly argue that the problem should be fixed in DMD, and that 'new T' should work for any T. One problem this PR does not fix is comparison between static arrays and dynamic arrays when at least one is stored in a Variant.
Comment #3 by github-bugzilla — 2018-01-31T06:03:50Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/875015e7af63eff5b893caffae1b60cac5fdd82e Fix Issue 10879 - std.variant Variant/Algebraic: Cant store static arrays > 32(/16) bytes https://github.com/dlang/phobos/commit/1fd20cf0d5f08948a757fb7734bf4477f3286833 Merge pull request #4204 from Biotronic/fix-10879 Fix Issue 10879 - std.variant Variant/Algebraic: Cant store static ar…