D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21708 - SumType.opEquals gives confusing error message
Summary: SumType.opEquals gives confusing error message
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 minor
Assignee: No Owner
URL:
Keywords: diagnostic, pull
Depends on:
Blocks:
 
Reported: 2021-03-13 14:46 UTC by Paul Backus
Modified: 2021-03-13 22:28 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Paul Backus 2021-03-13 14:46:06 UTC
Example code:

---
SumType!int x;
x == 123;
---

Error message:

---
src/sumtype.d(587,11): Error: void has no value
src/sumtype.d(587,39): Error: void has no value
---

This is confusing, because the actual error is that it is not valid to compare a `SumType!int` with an `int`.
Comment 1 Dlang Bot 2021-03-13 14:51:17 UTC
@pbackus created dlang/phobos pull request #7858 "Fix Issue 21708 - SumType.opEquals gives confusing error message" fixing this issue:

- Fix Issue 21708 - SumType.opEquals gives confusing error message

https://github.com/dlang/phobos/pull/7858
Comment 2 Dlang Bot 2021-03-13 22:28:52 UTC
dlang/phobos pull request #7858 "Fix Issue 21708 - SumType.opEquals gives confusing error message" was merged into master:

- dafbc5c36c509e0095223421f97a4ac964cf7d5a by Paul Backus:
  Fix Issue 21708 - SumType.opEquals gives confusing error message

https://github.com/dlang/phobos/pull/7858