Bug 19986 – Can't assign large const T to std.Variant.VariantN

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-06-19T08:39:12Z
Last change time
2019-07-08T05:15:51Z
Keywords
pull
Assigned to
No Owner
Creator
John Colvin

Comments

Comment #0 by john.loughran.colvin — 2019-06-19T08:39:12Z
import std.variant; void foo() { VariantN!32 v; v = const(ubyte[33]).init; } /dlang/dmd/linux/bin64/../../src/phobos/std/variant.d(680): Error: cannot modify const expression *p onlineapp.d(5): Error: template instance `std.variant.VariantN!32LU.VariantN.opAssign!(const(ubyte[33]))` error instantiating Works fine for const(ubyte[32]) or ubyte[33]
Comment #1 by dlang-bot — 2019-06-19T12:14:29Z
@shove70 created dlang/phobos pull request #7080 "Fix issue 19986 - Can't assign large const T to std.Variant.VariantN" fixing this issue: - Fix issue 19986 - Can't assign large const T to std.Variant.VariantN https://github.com/dlang/phobos/pull/7080
Comment #2 by atila.neves — 2019-06-27T21:39:11Z
I'm unsure of why this is a bug.
Comment #3 by john.loughran.colvin — 2019-07-01T13:39:54Z
(In reply to Atila Neves from comment #2) > I'm unsure of why this is a bug. Why would you expect it to work for const(ubyte[32]) or ubyte[33] but not for const(ubyte[33])?
Comment #4 by dlang-bot — 2019-07-08T05:15:51Z
dlang/phobos pull request #7080 "Fix issue 19986 - Can't assign large const T to std.Variant.VariantN" was merged into master: - b289b55b7d35f56100c55696c53dcd5756c327a3 by shove70: Fix issue 19986 - Can't assign large const T to std.Variant.VariantN https://github.com/dlang/phobos/pull/7080