From 2452cf10e6d7fad413022a8ceb3e59a8bfc5957e Mon Sep 17 00:00:00 2001 From: Herb Sutter Date: Sat, 22 Jun 2024 16:29:32 -1000 Subject: [PATCH] Change `cpp2::to_string` catchall overload from C `...` variadic to `auto const&` This avoids errors about passing non-PODs to variadics (even though the parameter is never used), and ensures the catchall is used only for a single parameter (not inadvertently for a format string) Closes #1136 --- include/cpp2util.h | 22 +++++++- ...mixed-bugfix-for-ufcs-non-local.cpp.output | 52 +++++++++---------- .../pure2-bugfix-for-ufcs-noexcept.cpp.output | 4 +- .../pure2-bugfix-for-ufcs-sfinae.cpp.output | 8 +-- ...s-clause-in-forward-declaration.cpp.output | 8 +-- .../gcc-10-c++20/pure2-print.cpp.output | 4 +- ...mixed-bugfix-for-ufcs-non-local.cpp.output | 40 +++++++------- 7 files changed, 79 insertions(+), 59 deletions(-) diff --git a/include/cpp2util.h b/include/cpp2util.h index d93913d38..320371543 100644 --- a/include/cpp2util.h +++ b/include/cpp2util.h @@ -264,6 +264,7 @@ #endif #include #include + #include #include #include #include @@ -1189,7 +1190,7 @@ struct nonesuch_ { }; constexpr inline nonesuch_ nonesuch; -inline auto to_string(...) -> std::string +inline auto to_string([[maybe_unused]] auto const& _) -> std::string { return "(customize me - no cpp2::to_string overload exists for this type)"; } @@ -1216,6 +1217,25 @@ inline auto to_string(T const& t) -> std::string return std::to_string(t); } +//// We'd like to add this convenience, which would support std::filesystem::path() and similar. +//// +//// TODO: As written, this one would make some cases ambiguous. We should rewrite these +//// common to_string functions as a single template with 'if constexpr' alternatives, +//// as was done with 'is', and then this will be simpler. +//template +//inline auto to_string(T const& t) -> std::string +// requires std::is_convertible_v +//{ +// return (std::stringstream() << t).str(); +//} + +template +inline auto to_string(T const& t) -> std::string + requires std::is_convertible_v +{ + return t.to_string(); +} + inline auto to_string(char const& t) -> std::string { return std::string{t}; diff --git a/regression-tests/test-results/clang-12-c++20/mixed-bugfix-for-ufcs-non-local.cpp.output b/regression-tests/test-results/clang-12-c++20/mixed-bugfix-for-ufcs-non-local.cpp.output index 6bf02b512..e1b3714c2 100644 --- a/regression-tests/test-results/clang-12-c++20/mixed-bugfix-for-ufcs-non-local.cpp.output +++ b/regression-tests/test-results/clang-12-c++20/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:1171:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:1172: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:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134: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:1171:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:1172: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:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134: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:1171:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:1172: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:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134: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:1171:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:1172: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:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134: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:1171:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:1172: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:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134: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:1171:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:1172: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:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134: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:1171:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:1172: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:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134: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:1171:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:1172: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:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134:66: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ ^ mixed-bugfix-for-ufcs-non-local.cpp2:37:28: 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:1171:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:1172: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:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134: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:1171:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:1172: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:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134: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:1171:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:1172: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:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134: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:1171:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:1172: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:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134:66: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \ ^ mixed-bugfix-for-ufcs-non-local.cpp2:41:84: 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:1171:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:1172: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:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134: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-c++20/pure2-bugfix-for-ufcs-noexcept.cpp.output b/regression-tests/test-results/clang-12-c++20/pure2-bugfix-for-ufcs-noexcept.cpp.output index f6b487203..1017d8127 100644 --- a/regression-tests/test-results/clang-12-c++20/pure2-bugfix-for-ufcs-noexcept.cpp.output +++ b/regression-tests/test-results/clang-12-c++20/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:1166:59: note: expanded from macro 'CPP2_UFCS' +../../../include/cpp2util.h:1167:59: note: expanded from macro 'CPP2_UFCS' #define CPP2_UFCS(...) CPP2_UFCS_(&,CPP2_UFCS_EMPTY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134: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-c++20/pure2-bugfix-for-ufcs-sfinae.cpp.output b/regression-tests/test-results/clang-12-c++20/pure2-bugfix-for-ufcs-sfinae.cpp.output index 091d91adf..186e24968 100644 --- a/regression-tests/test-results/clang-12-c++20/pure2-bugfix-for-ufcs-sfinae.cpp.output +++ b/regression-tests/test-results/clang-12-c++20/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:1171:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:1172: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:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134: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:1171:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:1172: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:1133:66: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:1134: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-c++20/pure2-bugfix-for-requires-clause-in-forward-declaration.cpp.output b/regression-tests/test-results/gcc-10-c++20/pure2-bugfix-for-requires-clause-in-forward-declaration.cpp.output index 186d8c4bb..1613a380e 100644 --- a/regression-tests/test-results/gcc-10-c++20/pure2-bugfix-for-requires-clause-in-forward-declaration.cpp.output +++ b/regression-tests/test-results/gcc-10-c++20/pure2-bugfix-for-requires-clause-in-forward-declaration.cpp.output @@ -6,12 +6,12 @@ pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2:3:46: error: expect In file included from pure2-bugfix-for-requires-clause-in-forward-declaration.cpp:7: ../../../include/cpp2util.h:10005:47: error: static assertion failed: GCC 11 or higher is required to support variables and type-scope functions that have a 'requires' clause. This includes a type-scope 'forward' parameter of non-wildcard type, such as 'func: (this, forward s: std::string)', which relies on being able to add a 'requires' clause - in that case, use 'forward s: _' instead if you need the result to compile with GCC 10. pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2:4:1: note: in expansion of macro ‘CPP2_REQUIRES_’ -pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2:3:3: error: no declaration matches ‘element::element(auto:92&&) requires is_same_v::type>::type>’ +pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2:3:3: error: no declaration matches ‘element::element(auto:93&&) requires is_same_v::type>::type>’ pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2:5:11: note: candidates are: ‘element::element(const element&)’ -pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2:3:20: note: ‘template element::element(auto:90&&)’ +pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2:3:20: note: ‘template element::element(auto:91&&)’ pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2:1:7: note: ‘class element’ defined here pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2:5:78: error: expected unqualified-id before ‘{’ token -pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2:3:8: error: no declaration matches ‘element& element::operator=(auto:93&&) requires is_same_v::type>::type>’ +pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2:3:8: error: no declaration matches ‘element& element::operator=(auto:94&&) requires is_same_v::type>::type>’ pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2:6:16: note: candidates are: ‘void element::operator=(const element&)’ -pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2:3:16: note: ‘template element& element::operator=(auto:91&&)’ +pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2:3:16: note: ‘template element& element::operator=(auto:92&&)’ pure2-bugfix-for-requires-clause-in-forward-declaration.cpp2:1:7: note: ‘class element’ defined here diff --git a/regression-tests/test-results/gcc-10-c++20/pure2-print.cpp.output b/regression-tests/test-results/gcc-10-c++20/pure2-print.cpp.output index 368bef73e..bfb12c17e 100644 --- a/regression-tests/test-results/gcc-10-c++20/pure2-print.cpp.output +++ b/regression-tests/test-results/gcc-10-c++20/pure2-print.cpp.output @@ -9,8 +9,8 @@ pure2-print.cpp2:68:1: note: in expansion of macro ‘CPP2_REQUIRES_’ pure2-print.cpp2:97:1: note: in expansion of macro ‘CPP2_REQUIRES_’ pure2-print.cpp2:9:41: error: ‘constexpr const T outer::object_alias’ is not a static data member of ‘class outer’ pure2-print.cpp2:9:48: error: template definition of non-template ‘constexpr const T outer::object_alias’ -pure2-print.cpp2:67:14: error: no declaration matches ‘void outer::mytype::variadic(const auto:91& ...) requires (is_convertible_v::type>::type, int> && ...)’ -pure2-print.cpp2:67:29: note: candidate is: ‘template static void outer::mytype::variadic(const auto:90& ...)’ +pure2-print.cpp2:67:14: error: no declaration matches ‘void outer::mytype::variadic(const auto:92& ...) requires (is_convertible_v::type>::type, int> && ...)’ +pure2-print.cpp2:67:29: note: candidate is: ‘template static void outer::mytype::variadic(const auto:91& ...)’ pure2-print.cpp2:10:19: note: ‘class outer::mytype’ defined here pure2-print.cpp2:96:37: error: no declaration matches ‘void outer::print(std::ostream&, const Args& ...) requires cpp2::impl::cmp_greater_eq(sizeof ... (Args ...), 0)’ pure2-print.cpp2:96:37: note: no functions named ‘void outer::print(std::ostream&, const Args& ...) requires cpp2::impl::cmp_greater_eq(sizeof ... (Args ...), 0)’ diff --git a/regression-tests/test-results/gcc-14-c++2b/mixed-bugfix-for-ufcs-non-local.cpp.output b/regression-tests/test-results/gcc-14-c++2b/mixed-bugfix-for-ufcs-non-local.cpp.output index 533f8cbae..0ec71cdf3 100644 --- a/regression-tests/test-results/gcc-14-c++2b/mixed-bugfix-for-ufcs-non-local.cpp.output +++ b/regression-tests/test-results/gcc-14-c++2b/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:1134:1: error: lambda-expression in template parameter type - 1134 | [LAMBDADEFCAPT]< \ +../../../include/cpp2util.h:1135:1: error: lambda-expression in template parameter type + 1135 | [LAMBDADEFCAPT]< \ | ^ -../../../include/cpp2util.h:1171:59: note: in expansion of macro ‘CPP2_UFCS_’ - 1171 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) +../../../include/cpp2util.h:1172:59: note: in expansion of macro ‘CPP2_UFCS_’ + 1172 | #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:1134:1: error: lambda-expression in template parameter type - 1134 | [LAMBDADEFCAPT]< \ +../../../include/cpp2util.h:1135:1: error: lambda-expression in template parameter type + 1135 | [LAMBDADEFCAPT]< \ | ^ -../../../include/cpp2util.h:1171:59: note: in expansion of macro ‘CPP2_UFCS_’ - 1171 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) +../../../include/cpp2util.h:1172:59: note: in expansion of macro ‘CPP2_UFCS_’ + 1172 | #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:1134:1: error: lambda-expression in template parameter type - 1134 | [LAMBDADEFCAPT]< \ +../../../include/cpp2util.h:1135:1: error: lambda-expression in template parameter type + 1135 | [LAMBDADEFCAPT]< \ | ^ -../../../include/cpp2util.h:1171:59: note: in expansion of macro ‘CPP2_UFCS_’ - 1171 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) +../../../include/cpp2util.h:1172:59: note: in expansion of macro ‘CPP2_UFCS_’ + 1172 | #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:1134:1: error: lambda-expression in template parameter type - 1134 | [LAMBDADEFCAPT]< \ +../../../include/cpp2util.h:1135:1: error: lambda-expression in template parameter type + 1135 | [LAMBDADEFCAPT]< \ | ^ -../../../include/cpp2util.h:1171:59: note: in expansion of macro ‘CPP2_UFCS_’ - 1171 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) +../../../include/cpp2util.h:1172:59: note: in expansion of macro ‘CPP2_UFCS_’ + 1172 | #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:1134:1: error: lambda-expression in template parameter type - 1134 | [LAMBDADEFCAPT]< \ +../../../include/cpp2util.h:1135:1: error: lambda-expression in template parameter type + 1135 | [LAMBDADEFCAPT]< \ | ^ -../../../include/cpp2util.h:1171:59: note: in expansion of macro ‘CPP2_UFCS_’ - 1171 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,CPP2_UFCS_IDENTITY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__) +../../../include/cpp2util.h:1172:59: note: in expansion of macro ‘CPP2_UFCS_’ + 1172 | #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