D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17482 - [REG 2.074] comile error: Comparing Nullable!Variant with basic type
Summary: [REG 2.074] comile error: Comparing Nullable!Variant with basic type
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-09 01:21 UTC by Nick Sabalausky
Modified: 2018-01-05 13:29 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Nick Sabalausky 2017-06-09 01:21:42 UTC
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)
Comment 1 Vladimir Panteleev 2017-06-09 07:32:45 UTC
Introduced in https://github.com/dlang/phobos/pull/5032
Comment 2 David Marquant 2017-06-12 11:15:37 UTC
Should it also be possible to assign values?

a = 11; // Isn't compiling as well
Comment 3 Jonathan M Davis 2017-07-04 02:24:39 UTC
(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.
Comment 4 Jonathan M Davis 2017-07-05 02:59:16 UTC
https://github.com/dlang/phobos/pull/5541
Comment 5 github-bugzilla 2017-07-07 22:09:34 UTC
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>
Comment 6 github-bugzilla 2017-07-10 04:19:54 UTC
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
Comment 7 github-bugzilla 2018-01-05 13:29:45 UTC
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