https://issues.dlang.org/show_bug.cgi?id=22016
Issue ID: 22016
Summary: [REG2.067] Wrong code with enum comparison in void
ternary with side effects
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Keywords: wrong-code
Severity: major
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
/////////////// test.d //////////////
enum E { one = 1 }
int i;
void gun(int n)
{
return n == E.one ? ++i : (){}();
}
void main()
{
gun(1);
assert(i == 1);
}
/////////////////////////////////////
Introduced in https://github.com/dlang/dmd/pull/3979
--