[PATCH] D82102: [AST][RecoveryExpr] Populate the error-bit from template arguments to TemplateSepcializationType.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 18 08:40:49 PDT 2020
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);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82102.271728.patch
Type: text/x-patch
Size: 2047 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200618/e4c4b077/attachment-0001.bin>
More information about the cfe-commits
mailing list