blob: fdb642c78fcc26d4794019b945e7d0b5314a06bd [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Douglas Gregor6c6fce02009-01-05 19:50:09 +00002extern "C" {
3 extern "C" void f(int);
4}
5
6extern "C++" {
7 extern "C++" int& g(int);
8 float& g();
9}
10double& g(double);
11
12void test(int x, double d) {
13 f(x);
14 float &f1 = g();
15 int& i1 = g(x);
16 double& d1 = g(d);
17}
Douglas Gregor17a9b9e2009-01-07 02:48:43 +000018
19extern "C" int foo;
20extern "C" int foo;
21
22extern "C" const int bar;
23extern "C" int const bar;
Anders Carlsson425bfde2009-05-16 22:05:23 +000024
25// <rdar://problem/6895431>
26extern "C" struct bar d;
27extern struct bar e;
Douglas Gregora24eb4e2009-08-24 18:55:03 +000028
29extern "C++" {
30 namespace N0 {
31 struct X0 {
32 int foo(int x) { return x; }
33 };
34 }
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000035}
Sebastian Redl9770ef02009-11-08 11:36:54 +000036
37// PR5430
38namespace pr5430 {
39 extern "C" void func(void);
40}
41using namespace pr5430;
42extern "C" void pr5430::func(void) { }
Douglas Gregor12372592009-12-08 15:38:36 +000043
44// PR5404
45int f2(char *)
46{
47 return 0;
48}
49
50extern "C"
51{
52 int f2(int)
53 {
54 return f2((char *)0);
55 }
56}
Abramo Bagnara35f9a192010-07-30 16:47:02 +000057
58// PR6991
59extern "C" typedef int (*PutcFunc_t)(int);
John McCall7b492022010-08-12 07:09:11 +000060
61
62// PR7859
63extern "C" void pr7859_a(int) {} // expected-note {{previous definition}}
64extern "C" void pr7859_a(int) {} // expected-error {{redefinition}}
65
66extern "C" void pr7859_b() {} // expected-note {{previous definition}}
67extern "C" void pr7859_b(int) {} // expected-error {{conflicting}}
68
69extern "C" void pr7859_c(short) {} // expected-note {{previous definition}}
70extern "C" void pr7859_c(int) {} // expected-error {{conflicting}}