xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/statements.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc void foo() {
4*f4a2713aSLionel Sambuc   return foo();
5*f4a2713aSLionel Sambuc }
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc // PR6451 - C++ Jump checking
8*f4a2713aSLionel Sambuc struct X {
9*f4a2713aSLionel Sambuc   X();
10*f4a2713aSLionel Sambuc };
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc void test2() {
13*f4a2713aSLionel Sambuc   goto later;  // expected-error {{goto into protected scope}}
14*f4a2713aSLionel Sambuc   X x;         // expected-note {{jump bypasses variable initialization}}
15*f4a2713aSLionel Sambuc later:
16*f4a2713aSLionel Sambuc   ;
17*f4a2713aSLionel Sambuc }
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc namespace PR6536 {
20*f4a2713aSLionel Sambuc   struct A {};
21*f4a2713aSLionel Sambuc   void a() { goto out; A x; out: return; }
22*f4a2713aSLionel Sambuc }
23