1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -fmodules %s
5 int x; // expected-note {{previous definition is here}}
7 void f() {} // expected-note {{previous definition is here}}
10 extern int x; // expected-error {{declaration of 'x' has a different language linkage}}
11 extern int y; // OK, has internal linkage, so no language linkage.
12 void f(); // expected-error {{declaration of 'f' has a different language linkage}}
16 // This is OK. Both test2_f don't have language linkage since they have
19 static void test2_f() {
21 static void test2_f(int x) {
58 class __attribute__ ((__visibility__("default"))) shared_future;
61 template <class> friend class shared_future;
62 shared_future<_Rp> share();
64 template <class _Rp> future<_Rp>
67 struct shared_future<_Rp&> {
68 shared_future(future<_Rp&>&& __f); // expected-warning {{rvalue references are a C++11 extension}}
74 shared_future<int&> f1 = get_future<int&>();
78 // This is OK. The variables have internal linkage and therefore no language
92 extern "C" { typedef int test7_F(); static test7_F test7_f; }
93 extern "C++" { extern test7_F test7_f; }
95 // FIXME: This should be invalid. The function has no language linkage, but
96 // the function type has, so this is redeclaring the function with a different
99 static void test8_f();
102 extern void test8_f();
105 static void test8_g();
108 extern void test8_g();
112 void __attribute__((overloadable)) test9_f(int c); // expected-note {{previous declaration is here}}
115 void __attribute__((overloadable)) test9_f(int c); // expected-error {{declaration of 'test9_f' has a different language linkage}}
119 void __attribute__((overloadable)) test10_f(int);
120 void __attribute__((overloadable)) test10_f(double);
125 void __attribute__((overloadable)) test11_g(int);
126 void __attribute__((overloadable)) test11_g(double);
141 static void a(void) {}
146 void a(void); // expected-note {{previous declaration is here}}
147 static void a(void) {} // expected-error {{static declaration of 'a' follows non-static declaration}}
152 const int a = 5; // expected-note {{previous definition is here}}
153 static const int a; // expected-error {{redefinition of 'a'}}
160 friend int bar(Foo *y);