• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 
3 namespace test1 {
4   extern "C" {
f()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" {
f()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" {
f()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" {
test4_f()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" {
test5_f()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 }
47 
48 extern "C" {
f()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 }
59