xref: /minix3/external/bsd/llvm/dist/clang/test/Parser/goto.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc /* RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc */
3*f4a2713aSLionel Sambuc 
test1()4*f4a2713aSLionel Sambuc void test1() {
5*f4a2713aSLionel Sambuc   goto ; /* expected-error {{expected identifier}} */
6*f4a2713aSLionel Sambuc }
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc 
test2()9*f4a2713aSLionel Sambuc void test2() {
10*f4a2713aSLionel Sambuc   l:  /* expected-note {{previous definition is here}} */
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc   {
13*f4a2713aSLionel Sambuc     __label__ l;
14*f4a2713aSLionel Sambuc   l: goto l;
15*f4a2713aSLionel Sambuc   }
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc   {
18*f4a2713aSLionel Sambuc     __label__ l;
19*f4a2713aSLionel Sambuc     __label__ h;   /* expected-error {{use of undeclared label 'h'}} */
20*f4a2713aSLionel Sambuc   l: goto l;
21*f4a2713aSLionel Sambuc   }
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc   /* PR3429 & rdar://8287027
24*f4a2713aSLionel Sambuc    */
25*f4a2713aSLionel Sambuc   {
26*f4a2713aSLionel Sambuc   l:  /* expected-error {{redefinition of label 'l'}} */
27*f4a2713aSLionel Sambuc     ;
28*f4a2713aSLionel Sambuc   }
29*f4a2713aSLionel Sambuc 
30*f4a2713aSLionel Sambuc }
31