[Issue 24749] New: A clause consisting only of "throw" should be the unlikely path
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Sep 7 20:21:54 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24749
Issue ID: 24749
Summary: A clause consisting only of "throw" should be the
unlikely path
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: bugzilla at digitalmars.com
As suggested by Quirin Schroll.
int foo(int i)
{
if (i)
throw new Exception("hello");
return i;
}
should emit code this way:
int foo(int i)
{
if (!i)
return i;
throw new Exception("hello");
}
so the return statement is considered the most likely code execution path.
--
More information about the Digitalmars-d-bugs
mailing list