https://bugs.llvm.org/show_bug.cgi?id=48749

            Bug ID: 48749
           Summary: clang allows goto inside statement expr
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

The following obviously incorrect program compiles without error under clang
and clang++:

#include <stdio.h>

int main(int argc, char** argv)
{
    goto L_bug;
    printf("%s, %s %s\n", "Hello", ({ L_bug: ; "world!";}), "What?");
}

gcc produces error: "error: jump into statement expression". g++ accepts this
code. (gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98682)

Tested clang versions: 11.0.0 and "Apple clang version 12.0.0
(clang-1200.0.32.28)".

This behaviour contradicts with documentation: "Jumping into a statement
expression with goto or using a switch statement outside the statement
expression with a case or default label inside the statement expression is not
permitted."

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to