[llvm-branch-commits] [clang] 4b38885 - Ensure that we transform types into the current instantiation even if
Richard Smith via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Dec 17 23:27:27 PST 2020
Author: Richard Smith
Date: 2020-12-17T23:23:05-08:00
New Revision: 4b388859f527f822a27bcee409242c421f199f1d
URL: https://github.com/llvm/llvm-project/commit/4b388859f527f822a27bcee409242c421f199f1d
DIFF: https://github.com/llvm/llvm-project/commit/4b388859f527f822a27bcee409242c421f199f1d.diff
LOG: Ensure that we transform types into the current instantiation even if
they're only instantiation-dependent.
Added:
Modified:
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/test/SemaTemplate/class-template-decl.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 2b6eb397b82b..949df53b40e0 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5491,7 +5491,7 @@ static bool RebuildDeclaratorInCurrentInstantiation(Sema &S, Declarator &D,
// Grab the type from the parser.
TypeSourceInfo *TSI = nullptr;
QualType T = S.GetTypeFromParser(DS.getRepAsType(), &TSI);
- if (T.isNull() || !T->isDependentType()) break;
+ if (T.isNull() || !T->isInstantiationDependentType()) break;
// Make sure there's a type source info. This isn't really much
// of a waste; most dependent types should have type source info
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index dd361ec91abe..64259767d98a 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -10730,7 +10730,7 @@ namespace {
/// For the purposes of type reconstruction, a type has already been
/// transformed if it is NULL or if it is not dependent.
bool AlreadyTransformed(QualType T) {
- return T.isNull() || !T->isDependentType();
+ return T.isNull() || !T->isInstantiationDependentType();
}
/// Returns the location of the entity whose type is being
@@ -10783,7 +10783,7 @@ namespace {
TypeSourceInfo *Sema::RebuildTypeInCurrentInstantiation(TypeSourceInfo *T,
SourceLocation Loc,
DeclarationName Name) {
- if (!T || !T->getType()->isDependentType())
+ if (!T || !T->getType()->isInstantiationDependentType())
return T;
CurrentInstantiationRebuilder Rebuilder(*this, Loc, Name);
diff --git a/clang/test/SemaTemplate/class-template-decl.cpp b/clang/test/SemaTemplate/class-template-decl.cpp
index 453218ac3b40..c054a6a8d82f 100644
--- a/clang/test/SemaTemplate/class-template-decl.cpp
+++ b/clang/test/SemaTemplate/class-template-decl.cpp
@@ -167,3 +167,17 @@ namespace abstract_dependent_class {
};
template<typename T> A<T> *A<T>::clone() { return new A<T>; } // expected-error {{abstract class type 'A<T>'}}
}
+
+namespace qualified_out_of_line {
+ struct rbnode {};
+ template<typename T, typename U> struct pair {};
+ template<typename K, typename V> struct rbtree {
+ using base = rbnode;
+ pair<base, base> f();
+ };
+ template<typename K, typename V>
+ pair<typename rbtree<K, V>::base, typename rbtree<K, V>::base>
+ rbtree<K, V>::f() {
+ return {};
+ }
+}
More information about the llvm-branch-commits
mailing list