[llvm-bugs] [Bug 36075] New: break in statement expression results in -Wunreachable-code
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jan 24 06:51:37 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=36075
Bug ID: 36075
Summary: break in statement expression results in
-Wunreachable-code
Product: clang
Version: 5.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: wielkiegie at gmail.com
CC: llvm-bugs at lists.llvm.org
The following code results in -Wunreachable-code on clang 5.0 and trunk:
--------------------------------
int main()
{
while (true)
{
({ break; });
}
}
--------------------------------
prog.cc:5:9: warning: code will never be executed [-Wunreachable-code]
({ break; });
^~~~~~~~~~~~
--------------------------------
It seems the trigger is an unconditional "break" statement as the last one of
the expression statement.
The warning goes away after putting the expression statement inside a macro
which might be related to a fix for bug 13747, but the warning shouldn't be
generated regardless.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180124/8fe6da3d/attachment.html>
More information about the llvm-bugs
mailing list