PR31514: Add recursive self-instantiation check during template argument
deduction in partial ordering.
This prevents us from crashing due to attempting to instantiate the same class
template specialization definition multiple times. (Debug builds also appear to
sometimes hit the stack limit before hitting the instantiation depth limit in
this case.)
llvm-svn: 291407
diff --git a/clang/test/SemaTemplate/alias-templates.cpp b/clang/test/SemaTemplate/alias-templates.cpp
index bcdc84e..d70e868 100644
--- a/clang/test/SemaTemplate/alias-templates.cpp
+++ b/clang/test/SemaTemplate/alias-templates.cpp
@@ -244,3 +244,13 @@
template<typename = void> using A = int;
A<> a; // ok
}
+
+namespace PR31514 {
+ template<typename T, typename> using EnableTupleSize = T;
+
+ template<typename T> struct tuple_size { static const int value = 0; };
+ template<typename T> struct tuple_size<EnableTupleSize<const T, decltype(tuple_size<T>::value)>> {};
+ template<typename T> struct tuple_size<EnableTupleSize<volatile T, decltype(tuple_size<T>::value)>> {};
+
+ tuple_size<const int> t;
+}