Bug 15017 – [REG2.068.1-b2] assigning a Variant to be value in a hashmap
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-09-05T16:23:00Z
Last change time
2015-09-07T13:37:04Z
Keywords
link-failure, pull
Assigned to
nobody
Creator
tcdknutson
Comments
Comment #0 by tcdknutson — 2015-09-05T16:23:10Z
It seems that Phobos no longer handles a variant being assigned to a value in a hashmap.
Tested to be working in v2.068.0.
Reduced test case:
```
import std.variant ;
class TempleContext
{
// context variables
Variant[string] vars;
ref var(string name)
{
vars[name] = Variant();
}
}
```
Comment #1 by tcdknutson — 2015-09-05T16:25:11Z
Failure error from DMD:
```
/Users/dymk/Downloads/dmd2/osx/bin/../../src/phobos/std/variant.d: Error: function std.variant.VariantN!32LU.VariantN.__xopEquals errors compiling the function
```
Comment #2 by tcdknutson — 2015-09-05T16:33:57Z
Reduced variant.d
```
template maxSize(T...)
{
enum maxSize = T[0].sizeof;
}
struct VariantN(size_t maxDataSize, AllowedTypesParam...)
{
// Allow assignment from another variant which is a subset of this one
VariantN opAssign() {
}
// returns 1 if the two are equal
bool opEquals(T)(T ) {
}
}
alias Variant = VariantN!(maxSize!creal);
```