Chris Lattner | 6d97e5e | 2010-03-01 20:59:53 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify |
Chris Lattner | e878eb0 | 2008-12-18 02:03:48 +0000 | [diff] [blame] | 2 | |
| 3 | void foo() { |
| 4 | return foo(); |
| 5 | } |
Chris Lattner | 6d97e5e | 2010-03-01 20:59:53 +0000 | [diff] [blame] | 6 | |
| 7 | // PR6451 - C++ Jump checking |
| 8 | struct X { |
| 9 | X(); |
| 10 | }; |
| 11 | |
| 12 | void test2() { |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 13 | goto later; // expected-error {{cannot jump}} |
Chris Lattner | 6d97e5e | 2010-03-01 20:59:53 +0000 | [diff] [blame] | 14 | X x; // expected-note {{jump bypasses variable initialization}} |
| 15 | later: |
| 16 | ; |
| 17 | } |
Douglas Gregor | 516a6bc | 2010-03-08 02:45:10 +0000 | [diff] [blame] | 18 | |
| 19 | namespace PR6536 { |
| 20 | struct A {}; |
| 21 | void a() { goto out; A x; out: return; } |
| 22 | } |
Stephen Hines | 0e2c34f | 2015-03-23 12:09:02 -0700 | [diff] [blame] | 23 | |
| 24 | void test3() { |
| 25 | __asm__ ("":"+r" (test3)); // expected-error{{invalid lvalue in asm output}} |
| 26 | } |
| 27 | |
| 28 | void test4(); // expected-note{{possible target for call}} |
| 29 | void test4(int) { // expected-note{{possible target for call}} |
| 30 | // expected-error@+1{{overloaded function could not be resolved}} |
| 31 | __asm__ ("":"+r" (test4)); // expected-error{{invalid lvalue in asm output}} |
| 32 | } |
| 33 | void test5() { |
| 34 | char buf[1]; |
| 35 | __asm__ ("":"+r" (buf)); |
| 36 | } |
| 37 | |
| 38 | struct MMX_t {}; |
| 39 | void test6() { __asm__("" : "=m"(*(MMX_t *)0)); } |