We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5b4f650 commit 3884509Copy full SHA for 3884509
clang/lib/Sema/HeuristicResolver.cpp
@@ -138,7 +138,15 @@ TagDecl *HeuristicResolverImpl::resolveTypeToTagDecl(QualType QT) {
138
}
139
140
if (auto *TT = T->getAs<TagType>()) {
141
- return TT->getDecl();
+ TagDecl *TD = TT->getDecl();
142
+ // Template might not be instantiated yet, fall back to primary template
143
+ // in such cases.
144
+ if (const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(TD)) {
145
+ if (CTSD->getTemplateSpecializationKind() == TSK_Undeclared) {
146
+ return CTSD->getSpecializedTemplate()->getTemplatedDecl();
147
+ }
148
149
+ return TD;
150
151
152
if (const auto *ICNT = T->getAs<InjectedClassNameType>())
0 commit comments