Rafael Espindola | e57e3d3 | 2012-12-27 03:56:20 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | namespace test1 { |
| 4 | int x; // expected-note {{previous definition is here}} |
| 5 | static int y; // expected-note {{previous definition is here}} |
| 6 | void f() {} // expected-note {{previous definition is here}} |
| 7 | |
| 8 | extern "C" { |
| 9 | extern int x; // expected-error {{declaration of 'x' has a different language linkage}} |
| 10 | extern int y; // expected-error {{declaration of 'y' has a different language linkage}} |
| 11 | void f(); // expected-error {{declaration of 'f' has a different language linkage}} |
| 12 | } |
| 13 | } |
Rafael Espindola | 78eeba8 | 2012-12-28 14:21:58 +0000 | [diff] [blame] | 14 | |
| 15 | extern "C" { |
| 16 | static void test2_f() { // expected-note {{previous definition is here}} |
| 17 | } |
| 18 | static void test2_f(int x) { // expected-error {{conflicting types for 'test2_f'}} |
| 19 | } |
| 20 | } |
Rafael Espindola | 6acc4bc | 2013-01-05 01:28:37 +0000 | [diff] [blame] | 21 | |
| 22 | namespace test3 { |
| 23 | extern "C" { |
| 24 | namespace { |
| 25 | extern int x2; |
| 26 | void f2(); |
| 27 | } |
| 28 | } |
| 29 | namespace { |
| 30 | int x2; |
| 31 | void f2() {} |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | namespace test4 { |
| 36 | void dummy() { |
| 37 | void Bar(); |
| 38 | class A { |
| 39 | friend void Bar(); |
| 40 | }; |
| 41 | } |
| 42 | } |
Rafael Espindola | abe75ef | 2013-01-09 16:34:58 +0000 | [diff] [blame^] | 43 | |
| 44 | namespace test5 { |
| 45 | static void g(); |
| 46 | void f() |
| 47 | { |
| 48 | void g(); |
| 49 | } |
| 50 | } |