xref: /llvm-project/clang/test/Parser/while-loop-outside-function.c (revision edaae251cca07c34c55905c424a8f677623d0bd0)
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 
3 while // expected-error {{while loop outside of a function}}
4 (1) {};
5 
6 // without semicolon
7 while // expected-error {{while loop outside of a function}}
8 (1) {}
9 
10 int overload_return(); // expected-note {{previous declaration is here}}
11 
overload_return()12 void overload_return() // expected-error {{conflicting types for 'overload_return'}}
13 {
14     while(1) {};
15     while(1);
16 }
17 
18 while // expected-error {{while loop outside of a function}}
19 (1);
20 
21 void correct();
22 
correct()23 void correct() {
24     while(1) {};
25     while(1);
26 }
27