Skip to content

Commit 4b38885

Browse files
committed
Ensure that we transform types into the current instantiation even if
they're only instantiation-dependent.
1 parent 71886c5 commit 4b38885

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5491,7 +5491,7 @@ static bool RebuildDeclaratorInCurrentInstantiation(Sema &S, Declarator &D,
54915491
// Grab the type from the parser.
54925492
TypeSourceInfo *TSI = nullptr;
54935493
QualType T = S.GetTypeFromParser(DS.getRepAsType(), &TSI);
5494-
if (T.isNull() || !T->isDependentType()) break;
5494+
if (T.isNull() || !T->isInstantiationDependentType()) break;
54955495

54965496
// Make sure there's a type source info. This isn't really much
54975497
// of a waste; most dependent types should have type source info

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10730,7 +10730,7 @@ namespace {
1073010730
/// For the purposes of type reconstruction, a type has already been
1073110731
/// transformed if it is NULL or if it is not dependent.
1073210732
bool AlreadyTransformed(QualType T) {
10733-
return T.isNull() || !T->isDependentType();
10733+
return T.isNull() || !T->isInstantiationDependentType();
1073410734
}
1073510735

1073610736
/// Returns the location of the entity whose type is being
@@ -10783,7 +10783,7 @@ namespace {
1078310783
TypeSourceInfo *Sema::RebuildTypeInCurrentInstantiation(TypeSourceInfo *T,
1078410784
SourceLocation Loc,
1078510785
DeclarationName Name) {
10786-
if (!T || !T->getType()->isDependentType())
10786+
if (!T || !T->getType()->isInstantiationDependentType())
1078710787
return T;
1078810788

1078910789
CurrentInstantiationRebuilder Rebuilder(*this, Loc, Name);

clang/test/SemaTemplate/class-template-decl.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,17 @@ namespace abstract_dependent_class {
167167
};
168168
template<typename T> A<T> *A<T>::clone() { return new A<T>; } // expected-error {{abstract class type 'A<T>'}}
169169
}
170+
171+
namespace qualified_out_of_line {
172+
struct rbnode {};
173+
template<typename T, typename U> struct pair {};
174+
template<typename K, typename V> struct rbtree {
175+
using base = rbnode;
176+
pair<base, base> f();
177+
};
178+
template<typename K, typename V>
179+
pair<typename rbtree<K, V>::base, typename rbtree<K, V>::base>
180+
rbtree<K, V>::f() {
181+
return {};
182+
}
183+
}

0 commit comments

Comments
 (0)