Issue 77057
Summary C variable declaration after label is considered invalid
Labels new issue
Assignees
Reporter ChoHag
    If the declaration preceeds the label all is well. This is the same with or without the assignment in the declaration.

$ cat /tmp/wtf.c
int main () {
label:
 int var = 42;
        return var;
}

$ cc /tmp/wtf.c && ./a.out
/tmp/wtf.c:3:9: error: expected _expression_
        int var = 42;
        ^
/tmp/wtf.c:4:16: error: use of undeclared identifier 'var'
        return var;
               ^
2 errors generated.

$ cc -v
OpenBSD clang version 16.0.6
Target: amd64-unknown-openbsd7.4
Thread model: posix
InstalledDir: /usr/bin
cc: warning: argument unused during compilation: '-fbracket-depth=512' [-Wunused-command-line-argument]

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to