This revision was automatically updated to reflect the committed changes. Closed by commit rG09e7fe9859b4: [AST][RecoveryAST] Preserve the type by default for recovery expression. (authored by hokein). Herald added a subscriber: dang.
Changed prior to commit: https://reviews.llvm.org/D82657?vs=287030&id=287349#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82657/new/ https://reviews.llvm.org/D82657 Files: clang/include/clang/Driver/Options.td clang/lib/Frontend/CompilerInvocation.cpp clang/test/CXX/temp/temp.constr/temp.constr.order/function-templates.cpp clang/test/SemaCXX/abstract.cpp clang/test/SemaCXX/decl-expr-ambiguity.cpp clang/test/SemaCXX/recovery-expr-type.cpp clang/test/SemaCXX/type-convert-construct.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/SemaCXX/type-convert-construct.cpp =================================================================== --- clang/test/SemaCXX/type-convert-construct.cpp +++ clang/test/SemaCXX/type-convert-construct.cpp @@ -6,7 +6,7 @@ float v1 = float(1); int v2 = typeof(int)(1,2); // expected-error {{excess elements in scalar initializer}} typedef int arr[]; - int v3 = arr(); // expected-error {{array types cannot be value-initialized}} + arr(); // expected-error {{array types cannot be value-initialized}} typedef void fn_ty(); fn_ty(); // expected-error {{cannot create object of function type 'fn_ty'}} fn_ty(0); // expected-error {{functional-style cast from 'int' to 'fn_ty'}} Index: clang/test/SemaCXX/recovery-expr-type.cpp =================================================================== --- clang/test/SemaCXX/recovery-expr-type.cpp +++ clang/test/SemaCXX/recovery-expr-type.cpp @@ -86,3 +86,22 @@ (T(T())); // expected-error {{call to deleted constructor}} } } + +// verify the secondary diagnostic "no matching function" is emitted. +namespace test7 { +struct C { + C() = delete; // expected-note {{has been explicitly marked deleted}} +}; +void f(C &); // expected-note {{candidate function not viable: expects an l-value for 1st argument}} +void test() { + f(C()); // expected-error {{call to deleted constructor}} \ + expected-error {{no matching function for call}} +} +} + +// verify the secondary diagnostic "cannot initialize" is emitted. +namespace test8 { +typedef int arr[]; +int v = arr(); // expected-error {{array types cannot be value-initialized}} \ + expected-error {{cannot initialize a variable of type 'int' with an rvalue of type 'test8::arr'}} +} Index: clang/test/SemaCXX/decl-expr-ambiguity.cpp =================================================================== --- clang/test/SemaCXX/decl-expr-ambiguity.cpp +++ clang/test/SemaCXX/decl-expr-ambiguity.cpp @@ -12,7 +12,7 @@ T(a)->m = 7; int(a)++; // expected-error {{assignment to cast is illegal}} __extension__ int(a)++; // expected-error {{assignment to cast is illegal}} - __typeof(int)(a,5)<<a; // expected-error {{excess elements in scalar initializer}} + __typeof(int)(a,5)<<a; // expected-error {{excess elements in scalar initializer}} expected-warning {{expression result unused}} void(a), ++a; if (int(a)+1) {} for (int(a)+1;;) {} // expected-warning {{expression result unused}} Index: clang/test/SemaCXX/abstract.cpp =================================================================== --- clang/test/SemaCXX/abstract.cpp +++ clang/test/SemaCXX/abstract.cpp @@ -279,7 +279,7 @@ virtual void f() = 0; // expected-note {{unimplemented pure virtual method 'f' in 'C'}} }; - void foo( C& c ) {} + void foo(const C& c ) {} void bar( void ) { foo(C(99)); // expected-error {{allocating an object of abstract class type 'pr12658::C'}} 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@-1 {{candidate function [with T = long long, U = int]}} static_assert(sizeof(f<long long, int>())); -// expected-error@-1 {{call to 'f' is ambiguous}} +// expected-error@-1 {{call to 'f' is ambiguous}} \ + expected-error@-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 @@ -2934,8 +2934,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); Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -4043,8 +4043,7 @@ "encountering semantic errors">; def fno_recovery_ast : Flag<["-"], "fno-recovery-ast">; def frecovery_ast_type : Flag<["-"], "frecovery-ast-type">, - HelpText<"Preserve the type for recovery expressions when possible " - "(experimental)">; + HelpText<"Preserve the type for recovery expressions when possible">; def fno_recovery_ast_type : Flag<["-"], "fno-recovery-ast-type">; let Group = Action_Group in {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits