diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -3584,7 +3584,7 @@ auto *TemplateArgs = reinterpret_cast(this + 1); for (const TemplateArgument &Arg : Args) { - // Update instantiation-dependent and variably-modified bits. + // Update instantiation-dependent, variably-modified, and error bits. // If the canonical type exists and is non-dependent, the template // specialization type can be non-dependent even if one of the type // arguments is. Given: @@ -3596,7 +3596,7 @@ ~TypeDependence::Dependent); if (Arg.getKind() == TemplateArgument::Type) addDependence(Arg.getAsType()->getDependence() & - TypeDependence::VariablyModified); + (TypeDependence::VariablyModified | TypeDependence::Error)); new (TemplateArgs++) TemplateArgument(Arg); } diff --git a/clang/test/SemaCXX/invalid-template-base-specifier.cpp b/clang/test/SemaCXX/invalid-template-base-specifier.cpp --- a/clang/test/SemaCXX/invalid-template-base-specifier.cpp +++ b/clang/test/SemaCXX/invalid-template-base-specifier.cpp @@ -1,7 +1,6 @@ // RUN: %clang_cc1 -frecovery-ast -verify %s -bool Foo(int *); // expected-note {{candidate function not viable}} \ - // expected-note {{candidate function not viable}} +bool Foo(int *); // expected-note 3{{candidate function not viable}} template struct Crash : decltype(Foo(T())) { // expected-error {{no matching function for call to 'Foo'}} @@ -18,3 +17,12 @@ }; void test2() { Crash2(); } // expected-note {{in instantiation of template class 'Crash2' requested here}} + +template +class Base {}; +template +struct Crash3 : Base { // expected-error {{no matching function for call to 'Foo'}} + Crash3(){}; +}; + +void test3() { Crash3(); } // expected-note {{in instantiation of template class}}