[PATCH] D82657: [AST][RecoveryAST] Preserve the type by default for recovery expression.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 9 07:17:08 PDT 2020
hokein updated this revision to Diff 276733.
hokein added a comment.
rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82657/new/
https://reviews.llvm.org/D82657
Files:
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CXX/temp/temp.constr/temp.constr.order/function-templates.cpp
clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp
clang/test/SemaTemplate/dependent-names.cpp
Index: clang/test/SemaTemplate/dependent-names.cpp
===================================================================
--- clang/test/SemaTemplate/dependent-names.cpp
+++ clang/test/SemaTemplate/dependent-names.cpp
@@ -173,7 +173,7 @@
namespace O {
- void f(char&); // expected-note {{candidate function not viable}}
+ int f(char&); // expected-note {{candidate function not viable}}
template<typename T> struct C {
static const int n = f(T()); // expected-error {{no matching function}}
Index: clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp
===================================================================
--- clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp
+++ clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp
@@ -123,7 +123,10 @@
template<typename,typename,typename> struct S {};
template<typename T, typename U> using U = S<T, int, U>; // expected-note 2{{template parameter is declared here}}
template<typename...Ts> U<Ts...> &f(U<Ts...>, Ts...); // expected-error 2{{pack expansion used as argument for non-pack parameter of alias template}}
- S<int, int, double> &s1 = f({}, 0, 0.0); // expected-error {{no matching function}}
+ // The return type of f is invalid during instantiation, and int is the fallback.
+ // FIXME: would be nice to suppress the secondard "cannot bind to a value of unrelated type 'int'" diagnostic.
+ S<int, int, double> &s1 = f({}, 0, 0.0); // expected-error {{no matching function}} \
+ expected-error {{non-const lvalue reference to type 'S<int, int, double>' cannot bind to a value of unrelated type 'int'}}
}
namespace PR18401 {
Index: clang/test/CXX/temp/temp.constr/temp.constr.order/function-templates.cpp
===================================================================
--- clang/test/CXX/temp/temp.constr/temp.constr.order/function-templates.cpp
+++ clang/test/CXX/temp/temp.constr/temp.constr.order/function-templates.cpp
@@ -67,7 +67,8 @@
// expected-note at -1 {{candidate function [with T = long long, U = int]}}
static_assert(sizeof(f<long long, int>()));
-// expected-error at -1 {{call to 'f' is ambiguous}}
+// expected-error at -1 {{call to 'f' is ambiguous}} \
+ expected-error at -1 {{invalid application of 'sizeof' to an incomplete type 'void'}}
template<typename T>
concept C3 = true;
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -2929,8 +2929,8 @@
// Recovery AST still heavily relies on dependent-type machinery.
Opts.RecoveryAST =
Args.hasFlag(OPT_frecovery_ast, OPT_fno_recovery_ast, Opts.CPlusPlus);
- Opts.RecoveryASTType =
- Args.hasFlag(OPT_frecovery_ast_type, OPT_fno_recovery_ast_type, false);
+ Opts.RecoveryASTType = Args.hasFlag(
+ OPT_frecovery_ast_type, OPT_fno_recovery_ast_type, Opts.CPlusPlus);
Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions);
Opts.AccessControl = !Args.hasArg(OPT_fno_access_control);
Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82657.276733.patch
Type: text/x-patch
Size: 3207 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200709/ede4919b/attachment.bin>
More information about the cfe-commits
mailing list