TemplateParams(nullptr) {}
// Construct a template decl with the given name and parameters.
- // Used when there is not templated element (tt-params, alias?).
+ // Used when there is not templated element (tt-params).
TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L,
DeclarationName Name, TemplateParameterList *Params)
: NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr),
auto *TD = TST->getTemplateName().getAsTemplateDecl();
if (!TD)
continue;
- auto *BasePrimaryTemplate = cast<CXXRecordDecl>(TD->getTemplatedDecl());
+ auto *BasePrimaryTemplate =
+ dyn_cast_or_null<CXXRecordDecl>(TD->getTemplatedDecl());
+ if (!BasePrimaryTemplate)
+ continue;
// FIXME: Allow lookup into non-dependent bases of dependent bases, possibly
// by calling or integrating with the main LookupQualifiedName mechanism.
for (NamedDecl *ND : BasePrimaryTemplate->lookup(&II)) {
UndefVar.method(); // expected-error {{use of undeclared identifier 'UndefVar'}}
}
}
+
+namespace PR20716 {
+template <template <typename T> class A>
+struct B : A<int>
+{
+ XXX x; // expected-error {{unknown type name}}
+};
+
+template <typename T>
+struct C {};
+
+template <typename T>
+using D = C<T>;
+
+template <typename T>
+struct E : D<T>
+{
+ XXX x; // expected-error {{unknown type name}}
+};
+}