hokein created this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
DO NOT SUBMIT. Repository: rG LLVM Github Monorepo 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 @@ -176,7 +176,8 @@ void f(char&); // expected-note {{candidate function not viable}} template<typename T> 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'}} }; } 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}} + // 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<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@-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 @@ -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);
Index: clang/test/SemaTemplate/dependent-names.cpp =================================================================== --- clang/test/SemaTemplate/dependent-names.cpp +++ clang/test/SemaTemplate/dependent-names.cpp @@ -176,7 +176,8 @@ void f(char&); // expected-note {{candidate function not viable}} template<typename T> 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'}} }; } 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}} + // 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<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@-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 @@ -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);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits