From 22976065c217a92b0cf433f4e64535ec569869c1 Mon Sep 17 00:00:00 2001 From: Herb Sutter Date: Fri, 15 Mar 2024 18:19:31 -1000 Subject: [PATCH 1/2] Add UFCS failure case error diagnostics --- include/cpp2util.h | 27 ++++++++--- .../pure2-bugfix-for-ufcs-sfinae.cpp.output | 33 +++++++++++++ .../pure2-bugfix-for-ufcs-sfinae.cpp.output | 47 +++++++++++++++++++ .../pure2-bugfix-for-ufcs-sfinae.cpp.output | 22 +++++++++ 4 files changed, 122 insertions(+), 7 deletions(-) diff --git a/include/cpp2util.h b/include/cpp2util.h index 43f5d7d6b9..85f23ad5dc 100644 --- a/include/cpp2util.h +++ b/include/cpp2util.h @@ -27,7 +27,7 @@ // 2) Entities in namespace cpp2::impl::, and macros // // These should not be used by the program. They form the language -// support library intended to be called only from generated Cpp2 code. +// support library intended to be called only from generated code. // // For example, if a Cpp2 function leaves a local variable // uninitialized, cppfront will generate uses of impl::deferred_init<> @@ -937,6 +937,8 @@ class out { #define CPP2_UFCS_CONSTRAINT_ARG(...) IsViable #endif +template struct dependent_false : std::false_type {}; + #define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ [LAMBDADEFCAPT]< \ typename Obj, typename... Params \ @@ -945,13 +947,24 @@ class out { > \ CPP2_LAMBDA_NO_DISCARD (Obj&& obj, Params&& ...params) CPP2_FORCE_INLINE_LAMBDA_CLANG \ noexcept(CPP2_UFCS_IS_NOTHROW_ARG(MVFWD,QUALID,TEMPKW,__VA_ARGS__)) CPP2_FORCE_INLINE_LAMBDA -> decltype(auto) \ - requires CPP2_UFCS_CONSTRAINT_ARG(MVFWD,QUALID,TEMPKW,__VA_ARGS__) { \ - if constexpr (requires{ CPP2_FORWARD(obj).CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(CPP2_FORWARD(params)...); }) { \ - return CPP2_FORWARD(obj).CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(CPP2_FORWARD(params)...); \ - } else { \ - return MVFWD(CPP2_UFCS_REMPARENS QUALID __VA_ARGS__)(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); \ + /* requires CPP2_UFCS_CONSTRAINT_ARG(MVFWD,QUALID,TEMPKW,__VA_ARGS__) */ \ + { \ + if constexpr (requires{ CPP2_FORWARD(obj).CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(CPP2_FORWARD(params)...); }) { \ + return CPP2_FORWARD(obj).CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(CPP2_FORWARD(params)...); \ } \ -} + else if constexpr (requires{ MVFWD(CPP2_UFCS_REMPARENS QUALID __VA_ARGS__)(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); }) { \ + return MVFWD(CPP2_UFCS_REMPARENS QUALID __VA_ARGS__)(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); \ + } \ + else if constexpr (requires{ obj.CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(CPP2_FORWARD(params)...); }) { \ + static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, but the first would have succeeded if obj were an lvalue - the likely problem is that this is a definite last use of the object, and the function cannot accept an rvalue" ); \ + } \ + else if constexpr (requires{ MVFWD(CPP2_UFCS_REMPARENS QUALID __VA_ARGS__)(obj, CPP2_FORWARD(params)...); }) { \ + static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, but the second would have succeeded if obj were an lvalue - the likely problem is that this is a definite last use of the object, and the function cannot accept an rvalue" ); \ + } \ + else { \ + static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?" ); \ + } \ + } #define CPP2_UFCS(...) CPP2_UFCS_(&,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) #define CPP2_UFCS_MOVE(...) CPP2_UFCS_(&,std::move,(),,__VA_ARGS__) diff --git a/regression-tests/test-results/gcc-10/pure2-bugfix-for-ufcs-sfinae.cpp.output b/regression-tests/test-results/gcc-10/pure2-bugfix-for-ufcs-sfinae.cpp.output index e69de29bb2..1330fd451c 100644 --- a/regression-tests/test-results/gcc-10/pure2-bugfix-for-ufcs-sfinae.cpp.output +++ b/regression-tests/test-results/gcc-10/pure2-bugfix-for-ufcs-sfinae.cpp.output @@ -0,0 +1,33 @@ +In file included from pure2-bugfix-for-ufcs-sfinae.cpp:7: +pure2-bugfix-for-ufcs-sfinae.cpp2: In instantiation of ‘ [with Obj = B; Params = {}]’: +pure2-bugfix-for-ufcs-sfinae.cpp2:1:99: required by substitution of ‘template std::type_identity_t(T()))> f() [with T = B]’ +pure2-bugfix-for-ufcs-sfinae.cpp2:6:105: required by substitution of ‘template main():: mutable [with T = B]’ +/usr/include/c++/10/type_traits:2506:26: required by substitution of ‘template static std::__result_of_success()((declval<_Args>)()...)), std::__invoke_other> std::__result_of_other_impl::_S_test(int) [with _Fn = main()::&&; _Args = {B}]’ +/usr/include/c++/10/type_traits:2517:55: required from ‘struct std::__result_of_impl&&, B>’ +/usr/include/c++/10/type_traits:2961:12: recursively required by substitution of ‘template struct std::__is_invocable_impl<_Result, _Ret, true, std::__void_t > [with _Result = std::__invoke_result&&, B>; _Ret = void]’ +/usr/include/c++/10/type_traits:2961:12: required from ‘struct std::is_invocable&&, B>’ +/usr/include/c++/10/type_traits:3006:73: required from ‘constexpr const bool std::is_invocable_v&&, B>’ +pure2-bugfix-for-ufcs-sfinae.cpp2:7:24: required from here +../../../include/cpp2util.h:965:58: error: static assertion failed: this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly? + 965 | static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?" ); \ + | ^~~~~ +../../../include/cpp2util.h:974:59: note: in expansion of macro ‘CPP2_UFCS_’ + 974 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) + | ^~~~~~~~~~ +pure2-bugfix-for-ufcs-sfinae.cpp2:1:78: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ +pure2-bugfix-for-ufcs-sfinae.cpp2: In instantiation of ‘ [with Obj = B; Params = {}]’: +pure2-bugfix-for-ufcs-sfinae.cpp2:1:99: required by substitution of ‘template std::type_identity_t(T()))> f() [with T = B]’ +pure2-bugfix-for-ufcs-sfinae.cpp2:6:105: required by substitution of ‘template main():: mutable [with T = B]’ +/usr/include/c++/10/type_traits:2506:26: required by substitution of ‘template static std::__result_of_success()((declval<_Args>)()...)), std::__invoke_other> std::__result_of_other_impl::_S_test(int) [with _Fn = main()::&&; _Args = {B}]’ +/usr/include/c++/10/type_traits:2517:55: required from ‘struct std::__result_of_impl&&, B>’ +/usr/include/c++/10/type_traits:2961:12: recursively required by substitution of ‘template struct std::__is_invocable_impl<_Result, _Ret, true, std::__void_t > [with _Result = std::__invoke_result&&, B>; _Ret = void]’ +/usr/include/c++/10/type_traits:2961:12: required from ‘struct std::is_invocable&&, B>’ +/usr/include/c++/10/type_traits:3006:73: required from ‘constexpr const bool std::is_invocable_v&&, B>’ +pure2-bugfix-for-ufcs-sfinae.cpp2:7:24: required from here +../../../include/cpp2util.h:965:58: error: static assertion failed: this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly? + 965 | static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?" ); \ + | ^~~~~ +../../../include/cpp2util.h:974:59: note: in expansion of macro ‘CPP2_UFCS_’ + 974 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) + | ^~~~~~~~~~ +pure2-bugfix-for-ufcs-sfinae.cpp2:1:78: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ diff --git a/regression-tests/test-results/gcc-13/pure2-bugfix-for-ufcs-sfinae.cpp.output b/regression-tests/test-results/gcc-13/pure2-bugfix-for-ufcs-sfinae.cpp.output index e69de29bb2..848060715d 100644 --- a/regression-tests/test-results/gcc-13/pure2-bugfix-for-ufcs-sfinae.cpp.output +++ b/regression-tests/test-results/gcc-13/pure2-bugfix-for-ufcs-sfinae.cpp.output @@ -0,0 +1,47 @@ +In file included from pure2-bugfix-for-ufcs-sfinae.cpp:7: +pure2-bugfix-for-ufcs-sfinae.cpp2: In instantiation of ‘ [with Obj = B; Params = {}; bool IsNothrow = false]’: +pure2-bugfix-for-ufcs-sfinae.cpp2:1:99: required by substitution of ‘template std::type_identity_t(T()))> f() [with T = B]’ +pure2-bugfix-for-ufcs-sfinae.cpp2:6:105: required by substitution of ‘template main():: mutable [with T = B]’ +/usr/include/c++/13/type_traits:2558:26: required by substitution of ‘template static std::__result_of_success()((declval<_Args>)()...)), std::__invoke_other> std::__result_of_other_impl::_S_test(int) [with _Fn = main()::&&; _Args = {B}]’ +/usr/include/c++/13/type_traits:2569:55: required from ‘struct std::__result_of_impl&&, B>’ +/usr/include/c++/13/type_traits:3077:12: recursively required by substitution of ‘template struct std::__is_invocable_impl<_Result, _Ret, true, std::__void_t > [with _Result = std::__invoke_result&&, B>; _Ret = void]’ +/usr/include/c++/13/type_traits:3077:12: required from ‘struct std::is_invocable&&, B>’ +/usr/include/c++/13/type_traits:3365:71: required from ‘constexpr const bool std::is_invocable_v&&, B>’ +pure2-bugfix-for-ufcs-sfinae.cpp2:7:24: required from here +../../../include/cpp2util.h:965:58: error: static assertion failed: this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly? + 965 | static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?" ); \ + | ^~~~~ +../../../include/cpp2util.h:974:59: note: in expansion of macro ‘CPP2_UFCS_’ + 974 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) + | ^~~~~~~~~~ +pure2-bugfix-for-ufcs-sfinae.cpp2:1:78: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ +../../../include/cpp2util.h:965:58: note: ‘std::integral_constant::value’ evaluates to false + 965 | static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?" ); \ + | ^~~~~ +../../../include/cpp2util.h:974:59: note: in expansion of macro ‘CPP2_UFCS_’ + 974 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) + | ^~~~~~~~~~ +pure2-bugfix-for-ufcs-sfinae.cpp2:1:78: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ +pure2-bugfix-for-ufcs-sfinae.cpp2: In instantiation of ‘ [with Obj = B; Params = {}; bool IsNothrow = false]’: +pure2-bugfix-for-ufcs-sfinae.cpp2:1:99: required by substitution of ‘template std::type_identity_t(T()))> f() [with T = B]’ +pure2-bugfix-for-ufcs-sfinae.cpp2:6:105: required by substitution of ‘template main():: mutable [with T = B]’ +/usr/include/c++/13/type_traits:2558:26: required by substitution of ‘template static std::__result_of_success()((declval<_Args>)()...)), std::__invoke_other> std::__result_of_other_impl::_S_test(int) [with _Fn = main()::&&; _Args = {B}]’ +/usr/include/c++/13/type_traits:2569:55: required from ‘struct std::__result_of_impl&&, B>’ +/usr/include/c++/13/type_traits:3077:12: recursively required by substitution of ‘template struct std::__is_invocable_impl<_Result, _Ret, true, std::__void_t > [with _Result = std::__invoke_result&&, B>; _Ret = void]’ +/usr/include/c++/13/type_traits:3077:12: required from ‘struct std::is_invocable&&, B>’ +/usr/include/c++/13/type_traits:3365:71: required from ‘constexpr const bool std::is_invocable_v&&, B>’ +pure2-bugfix-for-ufcs-sfinae.cpp2:7:24: required from here +../../../include/cpp2util.h:965:58: error: static assertion failed: this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly? + 965 | static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?" ); \ + | ^~~~~ +../../../include/cpp2util.h:974:59: note: in expansion of macro ‘CPP2_UFCS_’ + 974 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) + | ^~~~~~~~~~ +pure2-bugfix-for-ufcs-sfinae.cpp2:1:78: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ +../../../include/cpp2util.h:965:58: note: ‘std::integral_constant::value’ evaluates to false + 965 | static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?" ); \ + | ^~~~~ +../../../include/cpp2util.h:974:59: note: in expansion of macro ‘CPP2_UFCS_’ + 974 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) + | ^~~~~~~~~~ +pure2-bugfix-for-ufcs-sfinae.cpp2:1:78: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ diff --git a/regression-tests/test-results/msvc-2022/pure2-bugfix-for-ufcs-sfinae.cpp.output b/regression-tests/test-results/msvc-2022/pure2-bugfix-for-ufcs-sfinae.cpp.output index 5d72f97501..0fe08b1b3f 100644 --- a/regression-tests/test-results/msvc-2022/pure2-bugfix-for-ufcs-sfinae.cpp.output +++ b/regression-tests/test-results/msvc-2022/pure2-bugfix-for-ufcs-sfinae.cpp.output @@ -1 +1,23 @@ pure2-bugfix-for-ufcs-sfinae.cpp +pure2-bugfix-for-ufcs-sfinae.cpp2(1): error C2338: static_assert failed: 'this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?' +pure2-bugfix-for-ufcs-sfinae.cpp2(1): note: the template instantiation context (the oldest one first) is +pure2-bugfix-for-ufcs-sfinae.cpp2(7): note: see reference to variable template 'const bool is_invocable_v<`main'::`2':: &&,B>' being compiled +C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\type_traits(1845): note: see reference to alias template instantiation 'std::_Decltype_invoke_nonzero<_Callable,B,>' being compiled + with + [ + _Callable=main:: && + ] +pure2-bugfix-for-ufcs-sfinae.cpp2(1): note: see reference to function template instantiation 'decltype(auto) ::operator ()(Obj &&) noexcept(false) const' being compiled + with + [ + T=B, + Obj=B + ] +pure2-bugfix-for-ufcs-sfinae.cpp2(1): error C2338: static_assert failed: 'this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?' +pure2-bugfix-for-ufcs-sfinae.cpp2(1): note: the template instantiation context (the oldest one first) is +pure2-bugfix-for-ufcs-sfinae.cpp2(1): note: see reference to function template instantiation 'decltype(auto) ::operator ()(Obj &&) noexcept(false) const' being compiled + with + [ + T=B, + Obj=B + ] From cf3ef9ad032a573d8f6f18c495ac069a8e49b5fc Mon Sep 17 00:00:00 2001 From: Herb Sutter Date: Sat, 16 Mar 2024 12:28:53 -1000 Subject: [PATCH 2/2] Restore UFCS SFINAE test to just _NONLOCAL versions Per https://github.com/hsutter/cppfront/pull/1023#issuecomment-2001972096 and followups --- include/cpp2util.h | 31 +++-- ...mixed-bugfix-for-ufcs-non-local.cpp.output | 130 +++++++++--------- .../pure2-bugfix-for-ufcs-noexcept.cpp.output | 10 +- .../pure2-bugfix-for-ufcs-sfinae.cpp.output | 20 +-- .../pure2-bugfix-for-ufcs-sfinae.cpp.output | 33 ----- ...mixed-bugfix-for-ufcs-non-local.cpp.output | 40 +++--- .../pure2-bugfix-for-ufcs-sfinae.cpp.output | 47 ------- .../pure2-bugfix-for-ufcs-sfinae.cpp.output | 22 --- 8 files changed, 119 insertions(+), 214 deletions(-) diff --git a/include/cpp2util.h b/include/cpp2util.h index 85f23ad5dc..6c4f8b41f1 100644 --- a/include/cpp2util.h +++ b/include/cpp2util.h @@ -887,6 +887,7 @@ class out { #endif #endif +#define CPP2_UFCS_EMPTY(...) #define CPP2_UFCS_IDENTITY(...) __VA_ARGS__ #define CPP2_UFCS_REMPARENS(...) __VA_ARGS__ @@ -939,7 +940,7 @@ class out { template struct dependent_false : std::false_type {}; -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ [LAMBDADEFCAPT]< \ typename Obj, typename... Params \ CPP2_UFCS_IS_NOTHROW_PARAM(MVFWD,QUALID,TEMPKW,__VA_ARGS__) \ @@ -947,7 +948,7 @@ template struct dependent_false : std::false_type {}; > \ CPP2_LAMBDA_NO_DISCARD (Obj&& obj, Params&& ...params) CPP2_FORCE_INLINE_LAMBDA_CLANG \ noexcept(CPP2_UFCS_IS_NOTHROW_ARG(MVFWD,QUALID,TEMPKW,__VA_ARGS__)) CPP2_FORCE_INLINE_LAMBDA -> decltype(auto) \ - /* requires CPP2_UFCS_CONSTRAINT_ARG(MVFWD,QUALID,TEMPKW,__VA_ARGS__) */ \ + SFINAE( requires CPP2_UFCS_CONSTRAINT_ARG(MVFWD,QUALID,TEMPKW,__VA_ARGS__) ) \ { \ if constexpr (requires{ CPP2_FORWARD(obj).CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(CPP2_FORWARD(params)...); }) { \ return CPP2_FORWARD(obj).CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(CPP2_FORWARD(params)...); \ @@ -956,24 +957,30 @@ template struct dependent_false : std::false_type {}; return MVFWD(CPP2_UFCS_REMPARENS QUALID __VA_ARGS__)(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); \ } \ else if constexpr (requires{ obj.CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(CPP2_FORWARD(params)...); }) { \ - static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, but the first would have succeeded if obj were an lvalue - the likely problem is that this is a definite last use of the object, and the function cannot accept an rvalue" ); \ + static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, but the first would have succeeded if obj were an lvalue - the likely problem is that this is a definite last use of the object (which automatically treats it as an rvalue / move candidate), and the function cannot accept an rvalue" ); \ + CPP2_FORWARD(obj).CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(CPP2_FORWARD(params)...); \ + MVFWD(CPP2_UFCS_REMPARENS QUALID __VA_ARGS__)(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); \ } \ else if constexpr (requires{ MVFWD(CPP2_UFCS_REMPARENS QUALID __VA_ARGS__)(obj, CPP2_FORWARD(params)...); }) { \ - static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, but the second would have succeeded if obj were an lvalue - the likely problem is that this is a definite last use of the object, and the function cannot accept an rvalue" ); \ + static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, but the second would have succeeded if obj were an lvalue - the likely problem is that this is a definite last use of the object, (which automatically treats it as an rvalue / move candidate) and the function cannot accept an rvalue" ); \ + CPP2_FORWARD(obj).CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(CPP2_FORWARD(params)...); \ + MVFWD(CPP2_UFCS_REMPARENS QUALID __VA_ARGS__)(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); \ } \ else { \ static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?" ); \ + CPP2_FORWARD(obj).CPP2_UFCS_REMPARENS QUALID TEMPKW __VA_ARGS__(CPP2_FORWARD(params)...); \ + MVFWD(CPP2_UFCS_REMPARENS QUALID __VA_ARGS__)(CPP2_FORWARD(obj), CPP2_FORWARD(params)...); \ } \ } -#define CPP2_UFCS(...) CPP2_UFCS_(&,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) -#define CPP2_UFCS_MOVE(...) CPP2_UFCS_(&,std::move,(),,__VA_ARGS__) -#define CPP2_UFCS_FORWARD(...) CPP2_UFCS_(&,CPP2_FORWARD,(),,__VA_ARGS__) -#define CPP2_UFCS_TEMPLATE(...) CPP2_UFCS_(&,CPP2_UFCS_IDENTITY,(),template,__VA_ARGS__) -#define CPP2_UFCS_QUALIFIED_TEMPLATE(QUALID,...) CPP2_UFCS_(&,CPP2_UFCS_IDENTITY,QUALID,template,__VA_ARGS__) -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) -#define CPP2_UFCS_TEMPLATE_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),template,__VA_ARGS__) -#define CPP2_UFCS_QUALIFIED_TEMPLATE_NONLOCAL(QUALID,...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,QUALID,template,__VA_ARGS__) +#define CPP2_UFCS(...) CPP2_UFCS_(&,CPP2_UFCS_EMPTY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) +#define CPP2_UFCS_MOVE(...) CPP2_UFCS_(&,CPP2_UFCS_EMPTY,std::move,(),,__VA_ARGS__) +#define CPP2_UFCS_FORWARD(...) CPP2_UFCS_(&,CPP2_UFCS_EMPTY,CPP2_FORWARD,(),,__VA_ARGS__) +#define CPP2_UFCS_TEMPLATE(...) CPP2_UFCS_(&,CPP2_UFCS_EMPTY,CPP2_UFCS_IDENTITY,(),template,__VA_ARGS__) +#define CPP2_UFCS_QUALIFIED_TEMPLATE(QUALID,...) CPP2_UFCS_(&,CPP2_UFCS_EMPTY,CPP2_UFCS_IDENTITY,QUALID,template,__VA_ARGS__) +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) +#define CPP2_UFCS_TEMPLATE_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),template,__VA_ARGS__) +#define CPP2_UFCS_QUALIFIED_TEMPLATE_NONLOCAL(QUALID,...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,QUALID,template,__VA_ARGS__) } // impl diff --git a/regression-tests/test-results/clang-12/mixed-bugfix-for-ufcs-non-local.cpp.output b/regression-tests/test-results/clang-12/mixed-bugfix-for-ufcs-non-local.cpp.output index 04a76d3411..bfae96a7d7 100644 --- a/regression-tests/test-results/clang-12/mixed-bugfix-for-ufcs-non-local.cpp.output +++ b/regression-tests/test-results/clang-12/mixed-bugfix-for-ufcs-non-local.cpp.output @@ -1,118 +1,118 @@ mixed-bugfix-for-ufcs-non-local.cpp2:13:12: error: a lambda expression cannot appear in this context template UnnamedTypeParam1_1> bool inline constexpr v0 = false;// Fails on GCC ([GCC109781][]) and Clang 12 (a lambda expression cannot appear in this context) ^ -../../../include/cpp2util.h:961:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:981:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ mixed-bugfix-for-ufcs-non-local.cpp2:15:3: error: a lambda expression cannot appear in this context t inline constexpr v1 = t();// Fails on Clang 12 (lambda in unevaluated context). ^ -../../../include/cpp2util.h:961:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:981:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ mixed-bugfix-for-ufcs-non-local.cpp2:21:12: error: a lambda expression cannot appear in this context template UnnamedTypeParam1_2> auto g() -> void; ^ -../../../include/cpp2util.h:961:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:981:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ mixed-bugfix-for-ufcs-non-local.cpp2:23:42: error: a lambda expression cannot appear in this context auto g([[maybe_unused]] cpp2::impl::in> unnamed_param_1) -> void; ^ -../../../include/cpp2util.h:961:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:981:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ mixed-bugfix-for-ufcs-non-local.cpp2:27:29: error: a lambda expression cannot appear in this context [[nodiscard]] auto h() -> t; ^ -../../../include/cpp2util.h:961:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:981:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ mixed-bugfix-for-ufcs-non-local.cpp2:31:12: error: a lambda expression cannot appear in this context template UnnamedTypeParam1_3> using a = bool;// Fails on GCC ([GCC109781][]) and Clang 12 (a lambda expression cannot appear in this context) ^ -../../../include/cpp2util.h:961:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:981:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ mixed-bugfix-for-ufcs-non-local.cpp2:33:12: error: a lambda expression cannot appear in this context template UnnamedTypeParam1_4> auto inline constexpr b = false;// Fails on GCC ([GCC109781][]). ^ -../../../include/cpp2util.h:961:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:981:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ mixed-bugfix-for-ufcs-non-local.cpp2:35:13: error: a lambda expression cannot appear in this context using c = t;// Fails on Clang 12 (lambda in unevaluated context) and Clang 12 (a lambda expression cannot appear in this context) ^ -../../../include/cpp2util.h:961:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:981:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ mixed-bugfix-for-ufcs-non-local.cpp2:37:29: error: a lambda expression cannot appear in this context auto inline constexpr d = t();// Fails on Clang 12 (lambda in unevaluated context). ^ -../../../include/cpp2util.h:961:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:981:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ mixed-bugfix-for-ufcs-non-local.cpp2:21:12: error: a lambda expression cannot appear in this context template UnnamedTypeParam1_2> auto g() -> void{}// Fails on GCC ([GCC109781][]) and Clang 12 (a lambda expression cannot appear in this context) ^ -../../../include/cpp2util.h:961:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:981:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ mixed-bugfix-for-ufcs-non-local.cpp2:23:42: error: a lambda expression cannot appear in this context auto g([[maybe_unused]] cpp2::impl::in> unnamed_param_1) -> void{}// Fails on Clang 12 (lambda in unevaluated context). ^ -../../../include/cpp2util.h:961:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:981:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ mixed-bugfix-for-ufcs-non-local.cpp2:27:29: error: a lambda expression cannot appear in this context [[nodiscard]] auto h() -> t { return o; }// Fails on Clang 12 (lambda in unevaluated context). ^ -../../../include/cpp2util.h:961:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:981:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ mixed-bugfix-for-ufcs-non-local.cpp2:41:85: error: lambda expression in an unevaluated operand inline CPP2_CONSTEXPR bool u::c = [](cpp2::impl::in> x) mutable -> auto { return x; }(true);// Fails on Clang 12 (lambda in unevaluated context). ^ -../../../include/cpp2util.h:961:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:981:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ 13 errors generated. diff --git a/regression-tests/test-results/clang-12/pure2-bugfix-for-ufcs-noexcept.cpp.output b/regression-tests/test-results/clang-12/pure2-bugfix-for-ufcs-noexcept.cpp.output index ccf7f600a6..f81af5a072 100644 --- a/regression-tests/test-results/clang-12/pure2-bugfix-for-ufcs-noexcept.cpp.output +++ b/regression-tests/test-results/clang-12/pure2-bugfix-for-ufcs-noexcept.cpp.output @@ -1,10 +1,10 @@ pure2-bugfix-for-ufcs-noexcept.cpp2:5:26: error: lambda expression in an unevaluated operand static_assert(noexcept(CPP2_UFCS(swap)(t(), t())));// Fails on Clang 12 (lambda in unevaluated context) and GCC 10 (static assertion failed) ^ -../../../include/cpp2util.h:956:59: note: expanded from macro 'CPP2_UFCS' -#define CPP2_UFCS(...) CPP2_UFCS_(&,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:976:59: note: expanded from macro 'CPP2_UFCS' +#define CPP2_UFCS(...) CPP2_UFCS_(&,CPP2_UFCS_EMPTY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ 1 error generated. diff --git a/regression-tests/test-results/clang-12/pure2-bugfix-for-ufcs-sfinae.cpp.output b/regression-tests/test-results/clang-12/pure2-bugfix-for-ufcs-sfinae.cpp.output index 765ae4ecb1..62ed68b0b0 100644 --- a/regression-tests/test-results/clang-12/pure2-bugfix-for-ufcs-sfinae.cpp.output +++ b/regression-tests/test-results/clang-12/pure2-bugfix-for-ufcs-sfinae.cpp.output @@ -1,19 +1,19 @@ pure2-bugfix-for-ufcs-sfinae.cpp2:1:78: error: lambda expression in an unevaluated operand template [[nodiscard]] auto f() -> std::type_identity_t; ^ -../../../include/cpp2util.h:961:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:981:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ pure2-bugfix-for-ufcs-sfinae.cpp2:1:78: error: lambda expression in an unevaluated operand template [[nodiscard]] auto f() -> std::type_identity_t{}// Fails on Clang 12 (lambda in unevaluated context). ^ -../../../include/cpp2util.h:961:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' -#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - ^ -../../../include/cpp2util.h:940:59: note: expanded from macro 'CPP2_UFCS_' -#define CPP2_UFCS_(LAMBDADEFCAPT,MVFWD,QUALID,TEMPKW,...) \ +../../../include/cpp2util.h:981:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +#define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ +../../../include/cpp2util.h:943:66: note: expanded from macro 'CPP2_UFCS_' +#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ + ^ 2 errors generated. diff --git a/regression-tests/test-results/gcc-10/pure2-bugfix-for-ufcs-sfinae.cpp.output b/regression-tests/test-results/gcc-10/pure2-bugfix-for-ufcs-sfinae.cpp.output index 1330fd451c..e69de29bb2 100644 --- a/regression-tests/test-results/gcc-10/pure2-bugfix-for-ufcs-sfinae.cpp.output +++ b/regression-tests/test-results/gcc-10/pure2-bugfix-for-ufcs-sfinae.cpp.output @@ -1,33 +0,0 @@ -In file included from pure2-bugfix-for-ufcs-sfinae.cpp:7: -pure2-bugfix-for-ufcs-sfinae.cpp2: In instantiation of ‘ [with Obj = B; Params = {}]’: -pure2-bugfix-for-ufcs-sfinae.cpp2:1:99: required by substitution of ‘template std::type_identity_t(T()))> f() [with T = B]’ -pure2-bugfix-for-ufcs-sfinae.cpp2:6:105: required by substitution of ‘template main():: mutable [with T = B]’ -/usr/include/c++/10/type_traits:2506:26: required by substitution of ‘template static std::__result_of_success()((declval<_Args>)()...)), std::__invoke_other> std::__result_of_other_impl::_S_test(int) [with _Fn = main()::&&; _Args = {B}]’ -/usr/include/c++/10/type_traits:2517:55: required from ‘struct std::__result_of_impl&&, B>’ -/usr/include/c++/10/type_traits:2961:12: recursively required by substitution of ‘template struct std::__is_invocable_impl<_Result, _Ret, true, std::__void_t > [with _Result = std::__invoke_result&&, B>; _Ret = void]’ -/usr/include/c++/10/type_traits:2961:12: required from ‘struct std::is_invocable&&, B>’ -/usr/include/c++/10/type_traits:3006:73: required from ‘constexpr const bool std::is_invocable_v&&, B>’ -pure2-bugfix-for-ufcs-sfinae.cpp2:7:24: required from here -../../../include/cpp2util.h:965:58: error: static assertion failed: this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly? - 965 | static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?" ); \ - | ^~~~~ -../../../include/cpp2util.h:974:59: note: in expansion of macro ‘CPP2_UFCS_’ - 974 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - | ^~~~~~~~~~ -pure2-bugfix-for-ufcs-sfinae.cpp2:1:78: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ -pure2-bugfix-for-ufcs-sfinae.cpp2: In instantiation of ‘ [with Obj = B; Params = {}]’: -pure2-bugfix-for-ufcs-sfinae.cpp2:1:99: required by substitution of ‘template std::type_identity_t(T()))> f() [with T = B]’ -pure2-bugfix-for-ufcs-sfinae.cpp2:6:105: required by substitution of ‘template main():: mutable [with T = B]’ -/usr/include/c++/10/type_traits:2506:26: required by substitution of ‘template static std::__result_of_success()((declval<_Args>)()...)), std::__invoke_other> std::__result_of_other_impl::_S_test(int) [with _Fn = main()::&&; _Args = {B}]’ -/usr/include/c++/10/type_traits:2517:55: required from ‘struct std::__result_of_impl&&, B>’ -/usr/include/c++/10/type_traits:2961:12: recursively required by substitution of ‘template struct std::__is_invocable_impl<_Result, _Ret, true, std::__void_t > [with _Result = std::__invoke_result&&, B>; _Ret = void]’ -/usr/include/c++/10/type_traits:2961:12: required from ‘struct std::is_invocable&&, B>’ -/usr/include/c++/10/type_traits:3006:73: required from ‘constexpr const bool std::is_invocable_v&&, B>’ -pure2-bugfix-for-ufcs-sfinae.cpp2:7:24: required from here -../../../include/cpp2util.h:965:58: error: static assertion failed: this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly? - 965 | static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?" ); \ - | ^~~~~ -../../../include/cpp2util.h:974:59: note: in expansion of macro ‘CPP2_UFCS_’ - 974 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - | ^~~~~~~~~~ -pure2-bugfix-for-ufcs-sfinae.cpp2:1:78: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ diff --git a/regression-tests/test-results/gcc-13/mixed-bugfix-for-ufcs-non-local.cpp.output b/regression-tests/test-results/gcc-13/mixed-bugfix-for-ufcs-non-local.cpp.output index f6a3160867..c8083515c5 100644 --- a/regression-tests/test-results/gcc-13/mixed-bugfix-for-ufcs-non-local.cpp.output +++ b/regression-tests/test-results/gcc-13/mixed-bugfix-for-ufcs-non-local.cpp.output @@ -1,41 +1,41 @@ In file included from mixed-bugfix-for-ufcs-non-local.cpp:6: -../../../include/cpp2util.h:941:1: error: lambda-expression in template parameter type - 941 | [LAMBDADEFCAPT]< \ +../../../include/cpp2util.h:944:1: error: lambda-expression in template parameter type + 944 | [LAMBDADEFCAPT]< \ | ^ -../../../include/cpp2util.h:961:59: note: in expansion of macro ‘CPP2_UFCS_’ - 961 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) +../../../include/cpp2util.h:981:59: note: in expansion of macro ‘CPP2_UFCS_’ + 981 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) | ^~~~~~~~~~ mixed-bugfix-for-ufcs-non-local.cpp2:13:12: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ mixed-bugfix-for-ufcs-non-local.cpp2:13:36: error: template argument 1 is invalid -../../../include/cpp2util.h:941:1: error: lambda-expression in template parameter type - 941 | [LAMBDADEFCAPT]< \ +../../../include/cpp2util.h:944:1: error: lambda-expression in template parameter type + 944 | [LAMBDADEFCAPT]< \ | ^ -../../../include/cpp2util.h:961:59: note: in expansion of macro ‘CPP2_UFCS_’ - 961 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) +../../../include/cpp2util.h:981:59: note: in expansion of macro ‘CPP2_UFCS_’ + 981 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) | ^~~~~~~~~~ mixed-bugfix-for-ufcs-non-local.cpp2:21:12: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ mixed-bugfix-for-ufcs-non-local.cpp2:21:36: error: template argument 1 is invalid -../../../include/cpp2util.h:941:1: error: lambda-expression in template parameter type - 941 | [LAMBDADEFCAPT]< \ +../../../include/cpp2util.h:944:1: error: lambda-expression in template parameter type + 944 | [LAMBDADEFCAPT]< \ | ^ -../../../include/cpp2util.h:961:59: note: in expansion of macro ‘CPP2_UFCS_’ - 961 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) +../../../include/cpp2util.h:981:59: note: in expansion of macro ‘CPP2_UFCS_’ + 981 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) | ^~~~~~~~~~ mixed-bugfix-for-ufcs-non-local.cpp2:31:12: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ mixed-bugfix-for-ufcs-non-local.cpp2:31:36: error: template argument 1 is invalid -../../../include/cpp2util.h:941:1: error: lambda-expression in template parameter type - 941 | [LAMBDADEFCAPT]< \ +../../../include/cpp2util.h:944:1: error: lambda-expression in template parameter type + 944 | [LAMBDADEFCAPT]< \ | ^ -../../../include/cpp2util.h:961:59: note: in expansion of macro ‘CPP2_UFCS_’ - 961 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) +../../../include/cpp2util.h:981:59: note: in expansion of macro ‘CPP2_UFCS_’ + 981 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) | ^~~~~~~~~~ mixed-bugfix-for-ufcs-non-local.cpp2:33:12: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ mixed-bugfix-for-ufcs-non-local.cpp2:33:36: error: template argument 1 is invalid -../../../include/cpp2util.h:941:1: error: lambda-expression in template parameter type - 941 | [LAMBDADEFCAPT]< \ +../../../include/cpp2util.h:944:1: error: lambda-expression in template parameter type + 944 | [LAMBDADEFCAPT]< \ | ^ -../../../include/cpp2util.h:961:59: note: in expansion of macro ‘CPP2_UFCS_’ - 961 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) +../../../include/cpp2util.h:981:59: note: in expansion of macro ‘CPP2_UFCS_’ + 981 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) | ^~~~~~~~~~ mixed-bugfix-for-ufcs-non-local.cpp2:21:12: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ mixed-bugfix-for-ufcs-non-local.cpp2:21:36: error: template argument 1 is invalid diff --git a/regression-tests/test-results/gcc-13/pure2-bugfix-for-ufcs-sfinae.cpp.output b/regression-tests/test-results/gcc-13/pure2-bugfix-for-ufcs-sfinae.cpp.output index 848060715d..e69de29bb2 100644 --- a/regression-tests/test-results/gcc-13/pure2-bugfix-for-ufcs-sfinae.cpp.output +++ b/regression-tests/test-results/gcc-13/pure2-bugfix-for-ufcs-sfinae.cpp.output @@ -1,47 +0,0 @@ -In file included from pure2-bugfix-for-ufcs-sfinae.cpp:7: -pure2-bugfix-for-ufcs-sfinae.cpp2: In instantiation of ‘ [with Obj = B; Params = {}; bool IsNothrow = false]’: -pure2-bugfix-for-ufcs-sfinae.cpp2:1:99: required by substitution of ‘template std::type_identity_t(T()))> f() [with T = B]’ -pure2-bugfix-for-ufcs-sfinae.cpp2:6:105: required by substitution of ‘template main():: mutable [with T = B]’ -/usr/include/c++/13/type_traits:2558:26: required by substitution of ‘template static std::__result_of_success()((declval<_Args>)()...)), std::__invoke_other> std::__result_of_other_impl::_S_test(int) [with _Fn = main()::&&; _Args = {B}]’ -/usr/include/c++/13/type_traits:2569:55: required from ‘struct std::__result_of_impl&&, B>’ -/usr/include/c++/13/type_traits:3077:12: recursively required by substitution of ‘template struct std::__is_invocable_impl<_Result, _Ret, true, std::__void_t > [with _Result = std::__invoke_result&&, B>; _Ret = void]’ -/usr/include/c++/13/type_traits:3077:12: required from ‘struct std::is_invocable&&, B>’ -/usr/include/c++/13/type_traits:3365:71: required from ‘constexpr const bool std::is_invocable_v&&, B>’ -pure2-bugfix-for-ufcs-sfinae.cpp2:7:24: required from here -../../../include/cpp2util.h:965:58: error: static assertion failed: this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly? - 965 | static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?" ); \ - | ^~~~~ -../../../include/cpp2util.h:974:59: note: in expansion of macro ‘CPP2_UFCS_’ - 974 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - | ^~~~~~~~~~ -pure2-bugfix-for-ufcs-sfinae.cpp2:1:78: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ -../../../include/cpp2util.h:965:58: note: ‘std::integral_constant::value’ evaluates to false - 965 | static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?" ); \ - | ^~~~~ -../../../include/cpp2util.h:974:59: note: in expansion of macro ‘CPP2_UFCS_’ - 974 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - | ^~~~~~~~~~ -pure2-bugfix-for-ufcs-sfinae.cpp2:1:78: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ -pure2-bugfix-for-ufcs-sfinae.cpp2: In instantiation of ‘ [with Obj = B; Params = {}; bool IsNothrow = false]’: -pure2-bugfix-for-ufcs-sfinae.cpp2:1:99: required by substitution of ‘template std::type_identity_t(T()))> f() [with T = B]’ -pure2-bugfix-for-ufcs-sfinae.cpp2:6:105: required by substitution of ‘template main():: mutable [with T = B]’ -/usr/include/c++/13/type_traits:2558:26: required by substitution of ‘template static std::__result_of_success()((declval<_Args>)()...)), std::__invoke_other> std::__result_of_other_impl::_S_test(int) [with _Fn = main()::&&; _Args = {B}]’ -/usr/include/c++/13/type_traits:2569:55: required from ‘struct std::__result_of_impl&&, B>’ -/usr/include/c++/13/type_traits:3077:12: recursively required by substitution of ‘template struct std::__is_invocable_impl<_Result, _Ret, true, std::__void_t > [with _Result = std::__invoke_result&&, B>; _Ret = void]’ -/usr/include/c++/13/type_traits:3077:12: required from ‘struct std::is_invocable&&, B>’ -/usr/include/c++/13/type_traits:3365:71: required from ‘constexpr const bool std::is_invocable_v&&, B>’ -pure2-bugfix-for-ufcs-sfinae.cpp2:7:24: required from here -../../../include/cpp2util.h:965:58: error: static assertion failed: this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly? - 965 | static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?" ); \ - | ^~~~~ -../../../include/cpp2util.h:974:59: note: in expansion of macro ‘CPP2_UFCS_’ - 974 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - | ^~~~~~~~~~ -pure2-bugfix-for-ufcs-sfinae.cpp2:1:78: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ -../../../include/cpp2util.h:965:58: note: ‘std::integral_constant::value’ evaluates to false - 965 | static_assert( cpp2::impl::dependent_false::value, "this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?" ); \ - | ^~~~~ -../../../include/cpp2util.h:974:59: note: in expansion of macro ‘CPP2_UFCS_’ - 974 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) - | ^~~~~~~~~~ -pure2-bugfix-for-ufcs-sfinae.cpp2:1:78: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’ diff --git a/regression-tests/test-results/msvc-2022/pure2-bugfix-for-ufcs-sfinae.cpp.output b/regression-tests/test-results/msvc-2022/pure2-bugfix-for-ufcs-sfinae.cpp.output index 0fe08b1b3f..5d72f97501 100644 --- a/regression-tests/test-results/msvc-2022/pure2-bugfix-for-ufcs-sfinae.cpp.output +++ b/regression-tests/test-results/msvc-2022/pure2-bugfix-for-ufcs-sfinae.cpp.output @@ -1,23 +1 @@ pure2-bugfix-for-ufcs-sfinae.cpp -pure2-bugfix-for-ufcs-sfinae.cpp2(1): error C2338: static_assert failed: 'this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?' -pure2-bugfix-for-ufcs-sfinae.cpp2(1): note: the template instantiation context (the oldest one first) is -pure2-bugfix-for-ufcs-sfinae.cpp2(7): note: see reference to variable template 'const bool is_invocable_v<`main'::`2':: &&,B>' being compiled -C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\type_traits(1845): note: see reference to alias template instantiation 'std::_Decltype_invoke_nonzero<_Callable,B,>' being compiled - with - [ - _Callable=main:: && - ] -pure2-bugfix-for-ufcs-sfinae.cpp2(1): note: see reference to function template instantiation 'decltype(auto) ::operator ()(Obj &&) noexcept(false) const' being compiled - with - [ - T=B, - Obj=B - ] -pure2-bugfix-for-ufcs-sfinae.cpp2(1): error C2338: static_assert failed: 'this function call syntax tries 'obj.func(...)', then 'func(obj,...);' - both failed, did you spell the function name correctly?' -pure2-bugfix-for-ufcs-sfinae.cpp2(1): note: the template instantiation context (the oldest one first) is -pure2-bugfix-for-ufcs-sfinae.cpp2(1): note: see reference to function template instantiation 'decltype(auto) ::operator ()(Obj &&) noexcept(false) const' being compiled - with - [ - T=B, - Obj=B - ]