Skip to content

Commit

Permalink
Move UFCS to end of cpp2util.h
Browse files Browse the repository at this point in the history
Seeing if this can make the known-error test cases less sensitive to future line number changes
  • Loading branch information
hsutter committed Oct 27, 2024
1 parent dc3758a commit ebfb7bc
Show file tree
Hide file tree
Showing 16 changed files with 249 additions and 308 deletions.
297 changes: 149 additions & 148 deletions include/cpp2util.h

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,134 +1,134 @@
mixed-bugfix-for-ufcs-non-local.cpp2:13:12: error: a lambda expression cannot appear in this context
template<t<CPP2_UFCS_NONLOCAL(f)(o)> 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:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058: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<CPP2_UFCS_NONLOCAL(f)(o)> inline constexpr v1{ t<true>() };// Fails on Clang 12 (lambda in unevaluated context).
^
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058: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<t<CPP2_UFCS_NONLOCAL(f)(o)> UnnamedTypeParam1_2> auto g() -> void;
^
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058: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<t<CPP2_UFCS_NONLOCAL(f)(o)>> unnamed_param_1) -> void;
^
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058: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<CPP2_UFCS_NONLOCAL(f)(o)>;
^
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058: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<t<CPP2_UFCS_NONLOCAL(f)(o)> UnnamedTypeParam1_3> using a = bool;// Fails on GCC ([GCC109781][]) and Clang 12 (a lambda expression cannot appear in this context)
^
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058: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<t<CPP2_UFCS_NONLOCAL(f)(o)> UnnamedTypeParam1_4> auto inline constexpr b{ false };// Fails on GCC ([GCC109781][]).
^
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058: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<CPP2_UFCS_NONLOCAL(f)(o)>;// Fails on Clang 12 (lambda in unevaluated context) and Clang 12 (a lambda expression cannot appear in this context)
^
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058: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<CPP2_UFCS_NONLOCAL(f)(o)>() };// Fails on Clang 12 (lambda in unevaluated context).
^
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058: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<t<CPP2_UFCS_NONLOCAL(f)(o)> UnnamedTypeParam1_2> auto g() -> void{}// Fails on GCC ([GCC109781][]) and Clang 12 (a lambda expression cannot appear in this context)
^
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058: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<t<CPP2_UFCS_NONLOCAL(f)(o)>> unnamed_param_1) -> void{}// Fails on Clang 12 (lambda in unevaluated context).
^
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058: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<CPP2_UFCS_NONLOCAL(f)(o)> { return o; }// Fails on Clang 12 (lambda in unevaluated context).
^
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058:66: note: expanded from macro 'CPP2_UFCS_'
#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \
^
mixed-bugfix-for-ufcs-non-local.cpp2:42:77: error: no matching function for call to object of type 'ns::u::(lambda at mixed-bugfix-for-ufcs-non-local.cpp2:42:77)'
requires (std::is_convertible_v<CPP2_TYPEOF(x), std::add_const_t<decltype(CPP2_UFCS_NONLOCAL(f)(o))>&>) { return CPP2_FORWARD(x); }(true) };
^~~~~~~~~~~~~~~~~~~~~
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058:66: note: expanded from macro 'CPP2_UFCS_'
#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \
^
mixed-bugfix-for-ufcs-non-local.cpp2:42:77: note: candidate template ignored: couldn't infer template argument 'Obj'
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058:66: note: expanded from macro 'CPP2_UFCS_'
#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \
^
mixed-bugfix-for-ufcs-non-local.cpp2:42:77: error: lambda expression in an unevaluated operand
requires (std::is_convertible_v<CPP2_TYPEOF(x), std::add_const_t<decltype(CPP2_UFCS_NONLOCAL(f)(o))>&>) { return CPP2_FORWARD(x); }(true) };
^
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058:66: note: expanded from macro 'CPP2_UFCS_'
#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \
^
14 errors generated.
Original file line number Diff line number Diff line change
@@ -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:2132:59: note: expanded from macro 'CPP2_UFCS'
../../../include/cpp2util.h:10091:59: note: expanded from macro 'CPP2_UFCS'
#define CPP2_UFCS(...) CPP2_UFCS_(&,CPP2_UFCS_EMPTY,CPP2_UFCS_IDENTITY,(),,__VA_ARGS__)
^
../../../include/cpp2util.h:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058:66: note: expanded from macro 'CPP2_UFCS_'
#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \
^
1 error generated.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
pure2-bugfix-for-ufcs-sfinae.cpp2:1:78: error: lambda expression in an unevaluated operand
template<typename T> [[nodiscard]] auto f() -> std::type_identity_t<decltype(CPP2_UFCS_NONLOCAL(a)(T()))>;
^
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058: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<typename T> [[nodiscard]] auto f() -> std::type_identity_t<decltype(CPP2_UFCS_NONLOCAL(a)(T()))>{}// Fails on Clang 12 (lambda in unevaluated context).
^
../../../include/cpp2util.h:2137:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL'
../../../include/cpp2util.h:10096: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:2099:66: note: expanded from macro 'CPP2_UFCS_'
../../../include/cpp2util.h:10058:66: note: expanded from macro 'CPP2_UFCS_'
#define CPP2_UFCS_(LAMBDADEFCAPT,SFINAE,MVFWD,QUALID,TEMPKW,...) \
^
2 errors generated.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pure2-last-use.cpp2:344:16: error: no template named 'move_only_function' in nam
pure2-last-use.cpp2:348:161: error: no member named 'move_only_function' in namespace 'std'
CPP2_REQUIRES_ (std::is_convertible_v<CPP2_TYPEOF(a_), std::add_const_t<std::unique_ptr<int>>&> && std::is_convertible_v<CPP2_TYPEOF(b_), std::add_const_t<std::move_only_function<int()>>&> && std::is_convertible_v<CPP2_TYPEOF(c_), std::add_const_t<std::add_lvalue_reference_t<int>>&>) ;
~~~~~^
../../../include/cpp2util.h:10008:43: note: expanded from macro 'CPP2_REQUIRES_'
../../../include/cpp2util.h:10109:43: note: expanded from macro 'CPP2_REQUIRES_'
#define CPP2_REQUIRES_(...) requires (__VA_ARGS__)
^~~~~~~~~~~
pure2-last-use.cpp2:348:188: error: expected expression
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
mixed-increment-decrement.cpp2:4:47: error: expected ‘;’ at end of member declaration
In file included from mixed-increment-decrement.cpp:6:
../../../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.
../../../include/cpp2util.h:10106: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.
mixed-increment-decrement.cpp2:5:1: note: in expansion of macro ‘CPP2_REQUIRES_’
mixed-increment-decrement.cpp2:4:39: error: expected ‘;’ at end of member declaration
In file included from mixed-increment-decrement.cpp:6:
../../../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.
../../../include/cpp2util.h:10106: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.
mixed-increment-decrement.cpp2:5:1: note: in expansion of macro ‘CPP2_REQUIRES_’
mixed-increment-decrement.cpp2:4:32: error: no declaration matches ‘iterator<T>& iterator<T>::operator++() & requires true’
mixed-increment-decrement.cpp2:4:18: note: candidates are: ‘iterator<T> iterator<T>::operator++(int) &’
Expand Down
Loading

0 comments on commit ebfb7bc

Please sign in to comment.