summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-10-15 23:19:58 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-10-15 23:19:58 +0000
commit0c1065fa883b79e9a0b0b22a24fdb0189d50e201 (patch)
tree035c035f802c3569833938ef86a1e27b08ddce39
parent2a2b57db0ef3c840bea962d78d337c875c360100 (diff)
downloadbcm5719-llvm-0c1065fa883b79e9a0b0b22a24fdb0189d50e201.tar.gz
bcm5719-llvm-0c1065fa883b79e9a0b0b22a24fdb0189d50e201.zip
Test that we can merge together explicit and partial specializations from
merged declarations of a class template. llvm-svn: 192746
-rw-r--r--clang/test/Modules/Inputs/cxx-templates-a.h8
-rw-r--r--clang/test/Modules/Inputs/cxx-templates-b.h8
-rw-r--r--clang/test/Modules/Inputs/cxx-templates-c.h7
-rw-r--r--clang/test/Modules/Inputs/module.map4
-rw-r--r--clang/test/Modules/cxx-templates.cpp8
5 files changed, 35 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/cxx-templates-a.h b/clang/test/Modules/Inputs/cxx-templates-a.h
index 0ca6e34d0bc..0b1614d3d9e 100644
--- a/clang/test/Modules/Inputs/cxx-templates-a.h
+++ b/clang/test/Modules/Inputs/cxx-templates-a.h
@@ -40,3 +40,11 @@ const auto enum_c_from_a = CommonTemplate<int>::c;
template<int> struct UseInt;
template<typename T> void UseRedeclaredEnum(UseInt<T() + CommonTemplate<char>::a>);
constexpr void (*UseRedeclaredEnumA)(UseInt<1>) = UseRedeclaredEnum<int>;
+
+template<typename> struct MergeSpecializations;
+template<typename T> struct MergeSpecializations<T*> {
+ typedef int partially_specialized_in_a;
+};
+template<> struct MergeSpecializations<char> {
+ typedef int explicitly_specialized_in_a;
+};
diff --git a/clang/test/Modules/Inputs/cxx-templates-b.h b/clang/test/Modules/Inputs/cxx-templates-b.h
index f0921a7e0b2..6cd83faf1a1 100644
--- a/clang/test/Modules/Inputs/cxx-templates-b.h
+++ b/clang/test/Modules/Inputs/cxx-templates-b.h
@@ -51,6 +51,14 @@ template<int> struct UseInt;
template<typename T> void UseRedeclaredEnum(UseInt<T() + CommonTemplate<char>::a>);
constexpr void (*UseRedeclaredEnumB)(UseInt<1>) = UseRedeclaredEnum<int>;
+template<typename> struct MergeSpecializations;
+template<typename T> struct MergeSpecializations<T&> {
+ typedef int partially_specialized_in_b;
+};
+template<> struct MergeSpecializations<double> {
+ typedef int explicitly_specialized_in_b;
+};
+
@import cxx_templates_a;
template<typename T> void UseDefinedInBImplIndirectly(T &v) {
PerformDelayedLookup(v);
diff --git a/clang/test/Modules/Inputs/cxx-templates-c.h b/clang/test/Modules/Inputs/cxx-templates-c.h
new file mode 100644
index 00000000000..4c0fc8a4a82
--- /dev/null
+++ b/clang/test/Modules/Inputs/cxx-templates-c.h
@@ -0,0 +1,7 @@
+template<typename> struct MergeSpecializations;
+template<typename T> struct MergeSpecializations<T[]> {
+ typedef int partially_specialized_in_c;
+};
+template<> struct MergeSpecializations<bool> {
+ typedef int explicitly_specialized_in_c;
+};
diff --git a/clang/test/Modules/Inputs/module.map b/clang/test/Modules/Inputs/module.map
index ac3543b6440..7534eb253d7 100644
--- a/clang/test/Modules/Inputs/module.map
+++ b/clang/test/Modules/Inputs/module.map
@@ -204,6 +204,10 @@ module cxx_templates_b {
header "cxx-templates-b.h"
}
+module cxx_templates_c {
+ header "cxx-templates-c.h"
+}
+
module cxx_decls {
module unimported {
header "cxx-decls-unimported.h"
diff --git a/clang/test/Modules/cxx-templates.cpp b/clang/test/Modules/cxx-templates.cpp
index 0965aa8b0bc..65f41f677be 100644
--- a/clang/test/Modules/cxx-templates.cpp
+++ b/clang/test/Modules/cxx-templates.cpp
@@ -5,6 +5,7 @@
@import cxx_templates_a;
@import cxx_templates_b;
+@import cxx_templates_c;
@import cxx_templates_common;
template<typename, char> struct Tmpl_T_C {};
@@ -93,6 +94,13 @@ RedeclaredAsFriend<int> raf1;
RedeclareTemplateAsFriend<double> rtaf;
RedeclaredAsFriend<double> raf2;
+MergeSpecializations<int*>::partially_specialized_in_a spec_in_a_1;
+MergeSpecializations<int&>::partially_specialized_in_b spec_in_b_1;
+MergeSpecializations<int[]>::partially_specialized_in_c spec_in_c_1;
+MergeSpecializations<char>::explicitly_specialized_in_a spec_in_a_2;
+MergeSpecializations<double>::explicitly_specialized_in_b spec_in_b_2;
+MergeSpecializations<bool>::explicitly_specialized_in_c spec_in_c_2;
+
@import cxx_templates_common;
typedef SomeTemplate<int*> SomeTemplateIntPtr;
OpenPOWER on IntegriCloud