hokein created this revision. hokein added a reviewer: sammccall. Herald added a project: clang.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D82102 Files: clang/lib/AST/Type.cpp clang/test/SemaCXX/invalid-template-base-specifier.cpp Index: clang/test/SemaCXX/invalid-template-base-specifier.cpp =================================================================== --- clang/test/SemaCXX/invalid-template-base-specifier.cpp +++ 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 <typename T> struct Crash : decltype(Foo(T())) { // expected-error {{no matching function for call to 'Foo'}} @@ -18,3 +17,12 @@ }; void test2() { Crash2<int>(); } // expected-note {{in instantiation of template class 'Crash2<int>' requested here}} + +template <typename T> +class Base {}; +template <typename T> +struct Crash3 : Base<decltype(Foo(T()))> { // expected-error {{no matching function for call to 'Foo'}} + Crash3(){}; +}; + +void test3() { Crash3<int>(); } // expected-note {{in instantiation of template class}} Index: clang/lib/AST/Type.cpp =================================================================== --- clang/lib/AST/Type.cpp +++ clang/lib/AST/Type.cpp @@ -3584,7 +3584,7 @@ auto *TemplateArgs = reinterpret_cast<TemplateArgument *>(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); }
Index: clang/test/SemaCXX/invalid-template-base-specifier.cpp =================================================================== --- clang/test/SemaCXX/invalid-template-base-specifier.cpp +++ 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 <typename T> struct Crash : decltype(Foo(T())) { // expected-error {{no matching function for call to 'Foo'}} @@ -18,3 +17,12 @@ }; void test2() { Crash2<int>(); } // expected-note {{in instantiation of template class 'Crash2<int>' requested here}} + +template <typename T> +class Base {}; +template <typename T> +struct Crash3 : Base<decltype(Foo(T()))> { // expected-error {{no matching function for call to 'Foo'}} + Crash3(){}; +}; + +void test3() { Crash3<int>(); } // expected-note {{in instantiation of template class}} Index: clang/lib/AST/Type.cpp =================================================================== --- clang/lib/AST/Type.cpp +++ clang/lib/AST/Type.cpp @@ -3584,7 +3584,7 @@ auto *TemplateArgs = reinterpret_cast<TemplateArgument *>(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); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits