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 ba9b1bf commit 9aff609Copy full SHA for 9aff609
clang/lib/Sema/HeuristicResolver.cpp
@@ -137,7 +137,15 @@ TagDecl *HeuristicResolverImpl::resolveTypeToTagDecl(QualType QT) {
137
}
138
139
if (auto *TT = T->getAs<TagType>()) {
140
- return TT->getDecl();
+ TagDecl *TD = TT->getDecl();
141
+ // Template might not be instantiated yet, fall back to primary template
142
+ // in such cases.
143
+ if (const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(TD)) {
144
+ if (CTSD->getTemplateSpecializationKind() == TSK_Undeclared) {
145
+ return CTSD->getSpecializedTemplate()->getTemplatedDecl();
146
+ }
147
148
+ return TD;
149
150
151
if (const auto *ICNT = T->getAs<InjectedClassNameType>())
0 commit comments