r192746 - Test that we can merge together explicit and partial specializations from
Richard Smith
richard-llvm at metafoo.co.uk
Tue Oct 15 16:19:58 PDT 2013
Author: rsmith
Date: Tue Oct 15 18:19:58 2013
New Revision: 192746
URL: http://llvm.org/viewvc/llvm-project?rev=192746&view=rev
Log:
Test that we can merge together explicit and partial specializations from
merged declarations of a class template.
Added:
cfe/trunk/test/Modules/Inputs/cxx-templates-c.h
Modified:
cfe/trunk/test/Modules/Inputs/cxx-templates-a.h
cfe/trunk/test/Modules/Inputs/cxx-templates-b.h
cfe/trunk/test/Modules/Inputs/module.map
cfe/trunk/test/Modules/cxx-templates.cpp
Modified: cfe/trunk/test/Modules/Inputs/cxx-templates-a.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/cxx-templates-a.h?rev=192746&r1=192745&r2=192746&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/cxx-templates-a.h (original)
+++ cfe/trunk/test/Modules/Inputs/cxx-templates-a.h Tue Oct 15 18:19:58 2013
@@ -40,3 +40,11 @@ const auto enum_c_from_a = CommonTemplat
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;
+};
Modified: cfe/trunk/test/Modules/Inputs/cxx-templates-b.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/cxx-templates-b.h?rev=192746&r1=192745&r2=192746&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/cxx-templates-b.h (original)
+++ cfe/trunk/test/Modules/Inputs/cxx-templates-b.h Tue Oct 15 18:19:58 2013
@@ -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);
Added: cfe/trunk/test/Modules/Inputs/cxx-templates-c.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/cxx-templates-c.h?rev=192746&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/cxx-templates-c.h (added)
+++ cfe/trunk/test/Modules/Inputs/cxx-templates-c.h Tue Oct 15 18:19:58 2013
@@ -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;
+};
Modified: cfe/trunk/test/Modules/Inputs/module.map
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/module.map?rev=192746&r1=192745&r2=192746&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/module.map (original)
+++ cfe/trunk/test/Modules/Inputs/module.map Tue Oct 15 18:19:58 2013
@@ -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"
Modified: cfe/trunk/test/Modules/cxx-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/cxx-templates.cpp?rev=192746&r1=192745&r2=192746&view=diff
==============================================================================
--- cfe/trunk/test/Modules/cxx-templates.cpp (original)
+++ cfe/trunk/test/Modules/cxx-templates.cpp Tue Oct 15 18:19:58 2013
@@ -5,6 +5,7 @@
@import cxx_templates_a;
@import cxx_templates_b;
+ at 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;
More information about the cfe-commits
mailing list