2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2009-01-06 03:50:09 +08:00
|
|
|
extern "C" {
|
|
|
|
extern "C" void f(int);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C++" {
|
|
|
|
extern "C++" int& g(int);
|
|
|
|
float& g();
|
|
|
|
}
|
|
|
|
double& g(double);
|
|
|
|
|
|
|
|
void test(int x, double d) {
|
|
|
|
f(x);
|
|
|
|
float &f1 = g();
|
|
|
|
int& i1 = g(x);
|
|
|
|
double& d1 = g(d);
|
|
|
|
}
|
2009-01-07 10:48:43 +08:00
|
|
|
|
|
|
|
extern "C" int foo;
|
|
|
|
extern "C" int foo;
|
|
|
|
|
|
|
|
extern "C" const int bar;
|
|
|
|
extern "C" int const bar;
|
2009-05-17 06:05:23 +08:00
|
|
|
|
|
|
|
// <rdar://problem/6895431>
|
|
|
|
extern "C" struct bar d;
|
|
|
|
extern struct bar e;
|
2009-08-25 02:55:03 +08:00
|
|
|
|
|
|
|
extern "C++" {
|
|
|
|
namespace N0 {
|
|
|
|
struct X0 {
|
|
|
|
int foo(int x) { return x; }
|
|
|
|
};
|
|
|
|
}
|
2009-11-08 09:45:36 +08:00
|
|
|
}
|
2009-11-08 19:36:54 +08:00
|
|
|
|
|
|
|
// PR5430
|
|
|
|
namespace pr5430 {
|
|
|
|
extern "C" void func(void);
|
|
|
|
}
|
|
|
|
using namespace pr5430;
|
|
|
|
extern "C" void pr5430::func(void) { }
|
2009-12-08 23:38:36 +08:00
|
|
|
|
|
|
|
// PR5404
|
|
|
|
int f2(char *)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
int f2(int)
|
|
|
|
{
|
|
|
|
return f2((char *)0);
|
|
|
|
}
|
|
|
|
}
|
2010-07-31 00:47:02 +08:00
|
|
|
|
|
|
|
// PR6991
|
|
|
|
extern "C" typedef int (*PutcFunc_t)(int);
|
2010-08-12 15:09:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
// PR7859
|
|
|
|
extern "C" void pr7859_a(int) {} // expected-note {{previous definition}}
|
|
|
|
extern "C" void pr7859_a(int) {} // expected-error {{redefinition}}
|
|
|
|
|
|
|
|
extern "C" void pr7859_b() {} // expected-note {{previous definition}}
|
|
|
|
extern "C" void pr7859_b(int) {} // expected-error {{conflicting}}
|
|
|
|
|
|
|
|
extern "C" void pr7859_c(short) {} // expected-note {{previous definition}}
|
|
|
|
extern "C" void pr7859_c(int) {} // expected-error {{conflicting}}
|
2010-08-18 00:09:23 +08:00
|
|
|
|
|
|
|
// <rdar://problem/8318976>
|
|
|
|
extern "C" {
|
|
|
|
struct s0 {
|
|
|
|
private:
|
|
|
|
s0();
|
|
|
|
s0(const s0 &);
|
|
|
|
};
|
|
|
|
}
|
2010-08-24 22:14:45 +08:00
|
|
|
|
|
|
|
//PR7754
|
|
|
|
extern "C++" template <class T> int pr7754(T param);
|
|
|
|
|
|
|
|
namespace N {
|
|
|
|
int value;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C++" using N::value;
|
2010-10-15 09:21:46 +08:00
|
|
|
|
|
|
|
// PR7076
|
|
|
|
extern "C" const char *Version_string = "2.9";
|
2011-10-10 06:57:49 +08:00
|
|
|
|
|
|
|
namespace PR9162 {
|
|
|
|
extern "C" {
|
|
|
|
typedef struct _ArtsSink ArtsSink;
|
|
|
|
struct _ArtsSink {
|
|
|
|
int sink;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
int arts_sink_get_type()
|
|
|
|
{
|
|
|
|
return sizeof(ArtsSink);
|
|
|
|
}
|
|
|
|
}
|