summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Modules')
-rw-r--r--clang/test/Modules/Inputs/cxx-linkage-cache.h11
-rw-r--r--clang/test/Modules/Inputs/module.map4
-rw-r--r--clang/test/Modules/cxx-linkage-cache.cpp8
3 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/cxx-linkage-cache.h b/clang/test/Modules/Inputs/cxx-linkage-cache.h
new file mode 100644
index 00000000000..df829279761
--- /dev/null
+++ b/clang/test/Modules/Inputs/cxx-linkage-cache.h
@@ -0,0 +1,11 @@
+// Reduced from a crash encountered with a modularized libc++, where
+// we would try to compute the linkage of a declaration before we
+// finish loading the relevant pieces of it.
+inline namespace D {
+ template<class>
+ struct U {
+ friend bool f(const U &);
+ };
+
+ template class U<int>;
+}
diff --git a/clang/test/Modules/Inputs/module.map b/clang/test/Modules/Inputs/module.map
index f219036e21d..53f2fd65d34 100644
--- a/clang/test/Modules/Inputs/module.map
+++ b/clang/test/Modules/Inputs/module.map
@@ -179,3 +179,7 @@ module cxx_many_overloads {
module cxx_inline_namespace {
header "cxx-inline-namespace.h"
}
+
+module cxx_linkage_cache {
+ header "cxx-linkage-cache.h"
+}
diff --git a/clang/test/Modules/cxx-linkage-cache.cpp b/clang/test/Modules/cxx-linkage-cache.cpp
new file mode 100644
index 00000000000..296cc8034f5
--- /dev/null
+++ b/clang/test/Modules/cxx-linkage-cache.cpp
@@ -0,0 +1,8 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11
+
+@import cxx_linkage_cache;
+
+T x; // expected-error {{unknown type name 'T'}}
+D::U<int> u;
+bool b = f(u);
OpenPOWER on IntegriCloud