Worked fine up through 2.073.2, but 2.074.0 gives a compiler error: ---------------------------------------- import std.variant, std.typecons; void main() { Nullable!Variant a; a == 11; // Yes, comparison intended } ---------------------------------------- test_nullable_variant.d(6): Error: template std.typecons.Nullable!(VariantN!32LU).Nullable.opEquals cannot deduce function from argument types !()(int), candidates are: /home/nick/.dvm/compilers/dmd-2.074.0/linux/bin/../../src/phobos/std/typecons.d(2212): std.typecons.Nullable!(VariantN!32LU).Nullable.opEquals()(auto ref const(typeof(this)) rhs) /home/nick/.dvm/compilers/dmd-2.074.0/linux/bin/../../src/phobos/std/typecons.d(2222): std.typecons.Nullable!(VariantN!32LU).Nullable.opEquals()(auto ref const(T) rhs)
Introduced in https://github.com/dlang/phobos/pull/5032
Should it also be possible to assign values? a = 11; // Isn't compiling as well
(In reply to David Marquant from comment #2) > Should it also be possible to assign values? > > a = 11; // Isn't compiling as well That did not compile with 2.073.2. So, regardless of what the desired behavior would be, the fact that that does not currently compile is not a regression. Also, a better example of the regression would probably be something like Nullable!Variant a = Variant(12); assert(a != 11); since the original example would actually fail an assertion otherwise - though the compilation error is the same.
https://github.com/dlang/phobos/pull/5541
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/a7ea880eb24a36e09e50de7b8b32d941110aa630 Fix issue 17482: Fix Nullable!Variant equality checks. https://github.com/dlang/phobos/commit/d07b10148dcfbf494a8f433ebf5646a4cb8d1b10 Merge pull request #5541 from jmdavis/issue_17482 Fix issue 17482: Fix Nullable!Variant equality checks. merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach@gmail.com>
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/a7ea880eb24a36e09e50de7b8b32d941110aa630 Fix issue 17482: Fix Nullable!Variant equality checks. https://github.com/dlang/phobos/commit/d07b10148dcfbf494a8f433ebf5646a4cb8d1b10 Merge pull request #5541 from jmdavis/issue_17482
Commits pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/a7ea880eb24a36e09e50de7b8b32d941110aa630 Fix issue 17482: Fix Nullable!Variant equality checks. https://github.com/dlang/phobos/commit/d07b10148dcfbf494a8f433ebf5646a4cb8d1b10 Merge pull request #5541 from jmdavis/issue_17482