1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 extern "C" { 3 extern "C" void f(int); 4 } 5 6 extern "C++" { 7 extern "C++" int& g(int); 8 float& g(); 9 } 10 double& g(double); 11 test(int x,double d)12void test(int x, double d) { 13 f(x); 14 float &f1 = g(); 15 int& i1 = g(x); 16 double& d1 = g(d); 17 } 18 19 extern "C" int foo; 20 extern "C" int foo; 21 22 extern "C" const int bar; 23 extern "C" int const bar; 24 25 // <rdar://problem/6895431> 26 extern "C" struct bar d; 27 extern struct bar e; 28 29 extern "C++" { 30 namespace N0 { 31 struct X0 { fooN0::X032 int foo(int x) { return x; } 33 }; 34 } 35 } 36 37 // PR5430 38 namespace pr5430 { 39 extern "C" void func(void); 40 } 41 using namespace pr5430; func(void)42extern "C" void pr5430::func(void) { } 43 44 // PR5404 f2(char *)45int f2(char *) 46 { 47 return 0; 48 } 49 50 extern "C" 51 { f2(int)52 int f2(int) 53 { 54 return f2((char *)0); 55 } 56 } 57 58 // PR6991 59 extern "C" typedef int (*PutcFunc_t)(int); 60 61 62 // PR7859 pr7859_a(int)63extern "C" void pr7859_a(int) {} // expected-note {{previous definition}} pr7859_a(int)64extern "C" void pr7859_a(int) {} // expected-error {{redefinition}} 65 pr7859_b()66extern "C" void pr7859_b() {} // expected-note {{previous definition}} pr7859_b(int)67extern "C" void pr7859_b(int) {} // expected-error {{conflicting}} 68 pr7859_c(short)69extern "C" void pr7859_c(short) {} // expected-note {{previous definition}} pr7859_c(int)70extern "C" void pr7859_c(int) {} // expected-error {{conflicting}} 71 72 // <rdar://problem/8318976> 73 extern "C" { 74 struct s0 { 75 private: 76 s0(); 77 s0(const s0 &); 78 }; 79 } 80 81 //PR7754 82 extern "C++" template <class T> int pr7754(T param); 83 84 namespace N { 85 int value; 86 } 87 88 extern "C++" using N::value; 89 90 // PR7076 91 extern "C" const char *Version_string = "2.9"; 92 93 namespace PR9162 { 94 extern "C" { 95 typedef struct _ArtsSink ArtsSink; 96 struct _ArtsSink { 97 int sink; 98 }; 99 } arts_sink_get_type()100 int arts_sink_get_type() 101 { 102 return sizeof(ArtsSink); 103 } 104 } 105