Test that we can merge together explicit and partial specializations from

merged declarations of a class template.

llvm-svn: 192746
This commit is contained in:
Richard Smith 2013-10-15 23:19:58 +00:00
parent 2a2b57db0e
commit 0c1065fa88
5 changed files with 35 additions and 0 deletions

View File

@ -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;
};

View File

@ -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);

View File

@ -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;
};

View File

@ -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"

View File

@ -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;