Rafael Espindola | c812c3a | 2013-03-12 19:45:57 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | namespace test1 { |
| 4 | extern "C" { |
| 5 | void f() { |
| 6 | void test1_g(int); // expected-note {{previous declaration is here}} |
| 7 | } |
| 8 | } |
| 9 | } |
| 10 | int test1_g(int); // expected-error {{functions that differ only in their return type cannot be overloaded}} |
| 11 | |
| 12 | namespace test2 { |
| 13 | extern "C" { |
| 14 | void f() { |
| 15 | extern int test2_x; // expected-note {{previous definition is here}} |
| 16 | } |
| 17 | } |
| 18 | } |
| 19 | float test2_x; // expected-error {{redefinition of 'test2_x' with a different type: 'float' vs 'int'}} |
| 20 | |
| 21 | namespace test3 { |
| 22 | extern "C" { |
| 23 | void f() { |
| 24 | extern int test3_b; // expected-note {{previous definition is here}} |
| 25 | } |
| 26 | } |
| 27 | extern "C" { |
| 28 | float test3_b; // expected-error {{redefinition of 'test3_b' with a different type: 'float' vs 'int'}} |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | extern "C" { |
| 33 | void test4_f() { |
| 34 | extern int test4_b; // expected-note {{previous definition is here}} |
| 35 | } |
| 36 | } |
| 37 | static float test4_b; // expected-error {{redefinition of 'test4_b' with a different type: 'float' vs 'int'}} |
| 38 | |
| 39 | extern "C" { |
| 40 | void test5_f() { |
| 41 | extern int test5_b; // expected-note {{previous definition is here}} |
| 42 | } |
| 43 | } |
| 44 | extern "C" { |
| 45 | static float test5_b; // expected-error {{redefinition of 'test5_b' with a different type: 'float' vs 'int'}} |
| 46 | } |
Rafael Espindola | 82aaebe | 2013-03-12 19:50:10 +0000 | [diff] [blame^] | 47 | |
| 48 | extern "C" { |
| 49 | void f() { |
| 50 | extern int test6_b; |
| 51 | } |
| 52 | } |
| 53 | namespace foo { |
| 54 | extern "C" { |
| 55 | static float test6_b; |
| 56 | extern float test6_b; |
| 57 | } |
| 58 | } |