blob: c55b10d9d6e39ac70c6f76e0ba16f08cac366e12 [file] [log] [blame]
Rafael Espindolac812c3a2013-03-12 19:45:57 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3namespace test1 {
4 extern "C" {
5 void f() {
6 void test1_g(int); // expected-note {{previous declaration is here}}
7 }
8 }
9}
10int test1_g(int); // expected-error {{functions that differ only in their return type cannot be overloaded}}
11
12namespace test2 {
13 extern "C" {
14 void f() {
15 extern int test2_x; // expected-note {{previous definition is here}}
16 }
17 }
18}
19float test2_x; // expected-error {{redefinition of 'test2_x' with a different type: 'float' vs 'int'}}
20
21namespace 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
32extern "C" {
33 void test4_f() {
34 extern int test4_b; // expected-note {{previous definition is here}}
35 }
36}
37static float test4_b; // expected-error {{redefinition of 'test4_b' with a different type: 'float' vs 'int'}}
38
39extern "C" {
40 void test5_f() {
41 extern int test5_b; // expected-note {{previous definition is here}}
42 }
43}
44extern "C" {
45 static float test5_b; // expected-error {{redefinition of 'test5_b' with a different type: 'float' vs 'int'}}
46}
Rafael Espindola82aaebe2013-03-12 19:50:10 +000047
48extern "C" {
49 void f() {
50 extern int test6_b;
51 }
52}
53namespace foo {
54 extern "C" {
55 static float test6_b;
56 extern float test6_b;
57 }
58}