[Issue 23126] wrong result of integer division in presence of assert within conditional operator expression
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 19 15:27:32 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23126
Paul Backus <snarwin+bugzilla at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
CC| |snarwin+bugzilla at gmail.com
Severity|enhancement |normal
--- Comment #1 from Paul Backus <snarwin+bugzilla at gmail.com> ---
Reduced:
---
int fun() { return 123456; }
int divide(int dividend)
{
return dividend == 0
? assert(0)
: dividend / dividend;
}
void main()
{
fun();
int c = divide(1);
assert(c == 1);
}
---
As of DMD 2.100.0, with -checkaction=context, this produces the following
output:
---
core.exception.AssertError at bug.d(14): 123456 != 1
---
--
More information about the Digitalmars-d-bugs
mailing list