Bug 23905 – Initialization of SumType with opaque enum causes ICE
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-05-08T13:26:43Z
Last change time
2023-05-16T12:29:00Z
Keywords
pull
Assigned to
No Owner
Creator
Paul Backus
Comments
Comment #0 by snarwin+bugzilla — 2023-05-08T13:26:43Z
As of DMD 2.103.1, the following program fails to compile:
---
import std.sumtype : SumType;
enum Foo;
void main(){
SumType!Foo data = Foo.init; // int.init;
}
---
The error message is:
---
Error: unknown, please file report on issues.dlang.org
---
Comment #1 by snarwin+bugzilla — 2023-05-08T13:27:21Z
Reduced:
---
struct SumType(T)
{
T storage;
bool opEquals(Rhs)(Rhs rhs)
if (is(typeof(Rhs.init)))
{
}
}
enum Foo;
void main(){
SumType!Foo data = Foo.init;
}
---
Comment #2 by razvan.nitu1305 — 2023-05-09T06:04:33Z