aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/linkage2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/linkage2.cpp')
-rw-r--r--test/SemaCXX/linkage2.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/SemaCXX/linkage2.cpp b/test/SemaCXX/linkage2.cpp
index 2cee581b49..3cfa98138b 100644
--- a/test/SemaCXX/linkage2.cpp
+++ b/test/SemaCXX/linkage2.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fmodules %s
namespace test1 {
int x; // expected-note {{previous definition is here}}
@@ -125,3 +126,41 @@ extern "C" {
void __attribute__((overloadable)) test11_g(double);
}
}
+
+namespace test12 {
+ const int n = 0;
+ extern const int n;
+ void f() {
+ extern const int n;
+ }
+}
+
+namespace test13 {
+ static void a(void);
+ extern void a();
+ static void a(void) {}
+}
+
+namespace test14 {
+ namespace {
+ void a(void); // expected-note {{previous declaration is here}}
+ static void a(void) {} // expected-error {{static declaration of 'a' follows non-static declaration}}
+ }
+}
+
+namespace test15 {
+ const int a = 5; // expected-note {{previous definition is here}}
+ static const int a; // expected-error {{redefinition of 'a'}}
+}
+
+namespace test16 {
+ extern "C" {
+ class Foo {
+ int x;
+ friend int bar(Foo *y);
+ };
+ int bar(Foo *y) {
+ return y->x;
+ }
+ }
+}