template, make sure to get the template that corresponds to *this*
declaration of the class template or specialization, rather than the
canonical specialization. Fixes PR5187.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84119
91177308-0d34-0410-b5e6-
96231b3b80d8
// which could be the current specialization or another
// specialization.
if (Record->isInjectedClassName()) {
- Record = cast<CXXRecordDecl>(Record->getCanonicalDecl());
+ Record = cast<CXXRecordDecl>(Record->getDeclContext());
if (Record->getDescribedClassTemplate())
return Record->getDescribedClassTemplate();
template struct p<bool>; // expected-note {{in instantiation of default argument for 'p<bool>' required here}}
template struct p<int>;
+
+// PR5187
+template<typename T, typename U>
+struct A;
+
+template<typename T, typename U = T>
+struct A;
+
+template<typename T, typename U>
+struct A {
+ void f(A<T>);
+};
+
+template<typename T>
+struct B { };
+
+template<>
+struct B<void> {
+ typedef B<void*> type;
+};