summaryrefslogtreecommitdiffstats
path: root/clang/test/PCH/cxx-templates.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/PCH/cxx-templates.h')
-rw-r--r--clang/test/PCH/cxx-templates.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/PCH/cxx-templates.h b/clang/test/PCH/cxx-templates.h
index f2111428ac8..bfdb3b8b3d2 100644
--- a/clang/test/PCH/cxx-templates.h
+++ b/clang/test/PCH/cxx-templates.h
@@ -402,8 +402,11 @@ namespace ClassScopeExplicitSpecializations {
template<int> constexpr int f() const { return 1; }
template<> constexpr int f<0>() const { return 2; }
};
+
template<> template<int> constexpr int A<0>::f() const { return 3; }
template<> template<> constexpr int A<0>::f<0>() const { return 4; }
+ template<> template<> constexpr int A<0>::f<1>() const { return 5; }
+
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winstantiation-after-specialization"
template int A<2>::f<0>() const;
@@ -411,4 +414,28 @@ namespace ClassScopeExplicitSpecializations {
template int A<2>::f<1>() const;
extern template int A<3>::f<0>() const;
extern template int A<3>::f<1>() const;
+
+ template<int> struct B {
+ template<typename> static const int v = 1;
+ template<typename T> static const int v<T*> = 2;
+ template<> static const int v<int> = 3;
+
+ template<typename> static constexpr int w = 1;
+ template<typename T> static constexpr int w<T*> = 2;
+ template<> static constexpr int w<int> = 3;
+ };
+
+ template<> template<typename> constexpr int B<0>::v = 4;
+ template<> template<typename T> constexpr int B<0>::v<T*> = 5;
+ template<> template<typename T> constexpr int B<0>::v<T&> = 6;
+ // This is ill-formed: the initializer of v<int> is instantiated with the
+ // class.
+ //template<> template<> constexpr int B<0>::v<int> = 7;
+ template<> template<> constexpr int B<0>::v<float> = 8;
+
+ template<> template<typename> constexpr int B<0>::w = 4;
+ template<> template<typename T> constexpr int B<0>::w<T*> = 5;
+ template<> template<typename T> constexpr int B<0>::w<T&> = 6;
+ template<> template<> constexpr int B<0>::w<int> = 7;
+ template<> template<> constexpr int B<0>::w<float> = 8;
}
OpenPOWER on IntegriCloud