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(); } } ```
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 ```
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); ```
Introduced in: https://github.com/D-Programming-Language/dmd/pull/4995 Compiler fix: https://github.com/D-Programming-Language/dmd/pull/5042
Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4a87ff64dfdc67419a69136ce542e88c67726701 fix Issue 15017 - assigning a Variant to be value in a hashmap https://github.com/D-Programming-Language/dmd/commit/c9c12bf14b054a589841a2a62f083106c8647fb5 Merge pull request #5042 from 9rnsr/fix15017 [REG2.068.1-b2] Issue 15017 - assigning a Variant to be value in a hashmap
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4a87ff64dfdc67419a69136ce542e88c67726701 fix Issue 15017 - assigning a Variant to be value in a hashmap https://github.com/D-Programming-Language/dmd/commit/c9c12bf14b054a589841a2a62f083106c8647fb5 Merge pull request #5042 from 9rnsr/fix15017