diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -2926,8 +2926,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); diff --git a/clang/test/CXX/temp/temp.constr/temp.constr.order/function-templates.cpp b/clang/test/CXX/temp/temp.constr/temp.constr.order/function-templates.cpp --- a/clang/test/CXX/temp/temp.constr/temp.constr.order/function-templates.cpp +++ b/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())); -// 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 concept C3 = true; diff --git a/clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp b/clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp --- a/clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp +++ b/clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp @@ -123,7 +123,10 @@ template struct S {}; template using U = S; // expected-note 2{{template parameter is declared here}} template U &f(U, Ts...); // expected-error 2{{pack expansion used as argument for non-pack parameter of alias template}} - S &s1 = f({}, 0, 0.0); // expected-error {{no matching function}} + // FIXME: suppress the spurious "annot bind to a value of unrelated type 'int'" diagnostic. + // The template function f is invalid, and int is the fallback return type? + S &s1 = f({}, 0, 0.0); // expected-error {{no matching function}} \ + // expected-error {{non-const lvalue reference to type 'S' cannot bind to a value of unrelated type 'int'}} } namespace PR18401 { diff --git a/clang/test/SemaTemplate/dependent-names.cpp b/clang/test/SemaTemplate/dependent-names.cpp --- a/clang/test/SemaTemplate/dependent-names.cpp +++ b/clang/test/SemaTemplate/dependent-names.cpp @@ -176,7 +176,8 @@ void f(char&); // expected-note {{candidate function not viable}} template struct C { - static const int n = f(T()); // expected-error {{no matching function}} + static const int n = f(T()); // expected-error {{no matching function}} \ + // expected-error {{cannot initialize a variable of type 'const int' with an lvalue of type 'void'}} }; }