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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to