diff --git a/regression-tests/pure2-break-continue.cpp2 b/regression-tests/pure2-break-continue.cpp2 index 98d929cafd..fef40f4ccb 100644 --- a/regression-tests/pure2-break-continue.cpp2 +++ b/regression-tests/pure2-break-continue.cpp2 @@ -93,11 +93,11 @@ do_continue_inner: () = } std::cout << "inner "; } - while j<3 next j++; + next j++ while j<3; std::cout << "outer "; } - while i<3 next i++; + next i++ while i<3; } do_continue_outer: () = @@ -112,11 +112,11 @@ do_continue_outer: () = } std::cout << "inner "; } - while j<3 next j++; + next j++ while j<3; std::cout << "outer "; } - while i<3 next i++; + next i++ while i<3; } do_break_inner: () = @@ -131,11 +131,11 @@ do_break_inner: () = } std::cout << "inner "; } - while j<3 next j++; + next j++ while j<3; std::cout << "outer "; } - while i<3 next i++; + next i++ while i<3; } do_break_outer: () = @@ -150,11 +150,11 @@ do_break_outer: () = } std::cout << "inner "; } - while j<3 next j++; + next j++ while j<3; std::cout << "outer "; } - while i<3 next i++; + next i++ while i<3; } for_continue_inner: () = diff --git a/regression-tests/pure2-intro-example-three-loops.cpp2 b/regression-tests/pure2-intro-example-three-loops.cpp2 index 816be0f4a4..aa51ea9599 100644 --- a/regression-tests/pure2-intro-example-three-loops.cpp2 +++ b/regression-tests/pure2-intro-example-three-loops.cpp2 @@ -19,7 +19,7 @@ main: () -> int = { do { std::cout << std::setw(4) << "**"; - } while i* > 1 next i*--; + } next i*-- while i*>0; std::cout << "\n"; for words do (inout word) diff --git a/regression-tests/pure2-print.cpp2 b/regression-tests/pure2-print.cpp2 index 038fd328f5..b56b427120 100644 --- a/regression-tests/pure2-print.cpp2 +++ b/regression-tests/pure2-print.cpp2 @@ -38,7 +38,7 @@ outer: @print type = { while s.empty() next a() { break; } - do { } while s.empty() next b(); + do { } next b() while s.empty(); label: for m next c() do (_) { continue label; } diff --git a/regression-tests/test-results/clang-12/mixed-bounds-check.cpp.execution b/regression-tests/test-results/clang-12/mixed-bounds-check.cpp.execution index 173634b6ed..5796c96761 100644 --- a/regression-tests/test-results/clang-12/mixed-bounds-check.cpp.execution +++ b/regression-tests/test-results/clang-12/mixed-bounds-check.cpp.execution @@ -1 +1 @@ -Bounds safety violation: out of bounds access attempt detected +Bounds safety violation: out of bounds access attempt detected - attempted index 5, [min,max] range is [0,4] 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 90457f49e1..fbfab0b0e2 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 _> bool inline constexpr v0 = false;// Fails on GCC ([GCC109781][]) and Clang 12 (a lambda expression cannot appear in this context) ^ -../../../include/cpp2util.h:856:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:857:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,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:856:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:857:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,QUALID,TEMPKW,...) \ ^ mixed-bugfix-for-ufcs-non-local.cpp2:21:12: error: a lambda expression cannot appear in this context template _> auto g() -> void; ^ -../../../include/cpp2util.h:856:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:857:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,QUALID,TEMPKW,...) \ ^ mixed-bugfix-for-ufcs-non-local.cpp2:23:36: error: a lambda expression cannot appear in this context auto g([[maybe_unused]] cpp2::in> unnamed_param_1) -> void; ^ -../../../include/cpp2util.h:856:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:857:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,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:856:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:857:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,QUALID,TEMPKW,...) \ ^ mixed-bugfix-for-ufcs-non-local.cpp2:31:12: error: a lambda expression cannot appear in this context template _> using a = bool;// Fails on GCC ([GCC109781][]) and Clang 12 (a lambda expression cannot appear in this context) ^ -../../../include/cpp2util.h:856:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:857:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,QUALID,TEMPKW,...) \ ^ mixed-bugfix-for-ufcs-non-local.cpp2:33:12: error: a lambda expression cannot appear in this context template _> auto inline constexpr b = false;// Fails on GCC ([GCC109781][]). ^ -../../../include/cpp2util.h:856:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:857:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,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:856:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:857:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,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:856:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:857:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,QUALID,TEMPKW,...) \ ^ mixed-bugfix-for-ufcs-non-local.cpp2:21:12: error: a lambda expression cannot appear in this context template _> auto g() -> void{}// Fails on GCC ([GCC109781][]) and Clang 12 (a lambda expression cannot appear in this context) ^ -../../../include/cpp2util.h:856:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:857:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,QUALID,TEMPKW,...) \ ^ mixed-bugfix-for-ufcs-non-local.cpp2:23:36: error: a lambda expression cannot appear in this context auto g([[maybe_unused]] cpp2::in> unnamed_param_1) -> void{}// Fails on Clang 12 (lambda in unevaluated context). ^ -../../../include/cpp2util.h:856:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:857:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,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:856:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:857:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,QUALID,TEMPKW,...) \ ^ mixed-bugfix-for-ufcs-non-local.cpp2:41:79: error: lambda expression in an unevaluated operand inline CPP2_CONSTEXPR bool u::c = [](cpp2::in> x) mutable -> auto { return x; }(true);// Fails on Clang 12 (lambda in unevaluated context). ^ -../../../include/cpp2util.h:856:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:857:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,QUALID,TEMPKW,...) \ ^ 13 errors generated. diff --git a/regression-tests/test-results/clang-12/pure2-break-continue.cpp.execution b/regression-tests/test-results/clang-12/pure2-break-continue.cpp.execution index d1e79e5ee6..c8af55771f 100644 --- a/regression-tests/test-results/clang-12/pure2-break-continue.cpp.execution +++ b/regression-tests/test-results/clang-12/pure2-break-continue.cpp.execution @@ -8,11 +8,11 @@ while_break_outer: 00 inner 01 do_continue_inner: - 00 inner 01 02 inner 03 inner outer 10 inner 11 12 inner 13 inner outer 20 inner 21 22 inner 23 inner outer 30 inner 31 32 inner 33 inner outer + 00 inner 01 02 inner outer 10 inner 11 12 inner outer 20 inner 21 22 inner outer do_continue_outer: - 00 inner 01 10 inner 11 20 inner 21 30 inner 31 + 00 inner 01 10 inner 11 20 inner 21 do_break_inner: - 00 inner 01 outer 10 inner 11 outer 20 inner 21 outer 30 inner 31 outer + 00 inner 01 outer 10 inner 11 outer 20 inner 21 outer do_break_outer: 00 inner 01 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 6ea4f9e604..4502d42913 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:853:59: note: expanded from macro 'CPP2_UFCS' +../../../include/cpp2util.h:854:59: note: expanded from macro 'CPP2_UFCS' #define CPP2_UFCS(...) CPP2_UFCS_(&,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,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 8f671cfa58..b034ff6679 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:856:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:857:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,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:856:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' +../../../include/cpp2util.h:857:59: note: expanded from macro 'CPP2_UFCS_NONLOCAL' #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) ^ -../../../include/cpp2util.h:837:53: note: expanded from macro 'CPP2_UFCS_' +../../../include/cpp2util.h:838:53: note: expanded from macro 'CPP2_UFCS_' #define CPP2_UFCS_(LAMBDADEFCAPT,QUALID,TEMPKW,...) \ ^ 2 errors generated. diff --git a/regression-tests/test-results/gcc-10/mixed-bounds-check.cpp.execution b/regression-tests/test-results/gcc-10/mixed-bounds-check.cpp.execution index 173634b6ed..5796c96761 100644 --- a/regression-tests/test-results/gcc-10/mixed-bounds-check.cpp.execution +++ b/regression-tests/test-results/gcc-10/mixed-bounds-check.cpp.execution @@ -1 +1 @@ -Bounds safety violation: out of bounds access attempt detected +Bounds safety violation: out of bounds access attempt detected - attempted index 5, [min,max] range is [0,4] diff --git a/regression-tests/test-results/gcc-10/pure2-break-continue.cpp.execution b/regression-tests/test-results/gcc-10/pure2-break-continue.cpp.execution index d1e79e5ee6..c8af55771f 100644 --- a/regression-tests/test-results/gcc-10/pure2-break-continue.cpp.execution +++ b/regression-tests/test-results/gcc-10/pure2-break-continue.cpp.execution @@ -8,11 +8,11 @@ while_break_outer: 00 inner 01 do_continue_inner: - 00 inner 01 02 inner 03 inner outer 10 inner 11 12 inner 13 inner outer 20 inner 21 22 inner 23 inner outer 30 inner 31 32 inner 33 inner outer + 00 inner 01 02 inner outer 10 inner 11 12 inner outer 20 inner 21 22 inner outer do_continue_outer: - 00 inner 01 10 inner 11 20 inner 21 30 inner 31 + 00 inner 01 10 inner 11 20 inner 21 do_break_inner: - 00 inner 01 outer 10 inner 11 outer 20 inner 21 outer 30 inner 31 outer + 00 inner 01 outer 10 inner 11 outer 20 inner 21 outer do_break_outer: 00 inner 01 diff --git a/regression-tests/test-results/gcc-13/mixed-bounds-check.cpp.execution b/regression-tests/test-results/gcc-13/mixed-bounds-check.cpp.execution index 173634b6ed..5796c96761 100644 --- a/regression-tests/test-results/gcc-13/mixed-bounds-check.cpp.execution +++ b/regression-tests/test-results/gcc-13/mixed-bounds-check.cpp.execution @@ -1 +1 @@ -Bounds safety violation: out of bounds access attempt detected +Bounds safety violation: out of bounds access attempt detected - attempted index 5, [min,max] range is [0,4] 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 1a79da6a8d..5231449ebc 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:838:1: error: lambda-expression in template parameter type - 838 | [LAMBDADEFCAPT]< \ +../../../include/cpp2util.h:839:1: error: lambda-expression in template parameter type + 839 | [LAMBDADEFCAPT]< \ | ^ -../../../include/cpp2util.h:856:59: note: in expansion of macro ‘CPP2_UFCS_’ - 856 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) +../../../include/cpp2util.h:857:59: note: in expansion of macro ‘CPP2_UFCS_’ + 857 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__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:838:1: error: lambda-expression in template parameter type - 838 | [LAMBDADEFCAPT]< \ +../../../include/cpp2util.h:839:1: error: lambda-expression in template parameter type + 839 | [LAMBDADEFCAPT]< \ | ^ -../../../include/cpp2util.h:856:59: note: in expansion of macro ‘CPP2_UFCS_’ - 856 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) +../../../include/cpp2util.h:857:59: note: in expansion of macro ‘CPP2_UFCS_’ + 857 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__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:838:1: error: lambda-expression in template parameter type - 838 | [LAMBDADEFCAPT]< \ +../../../include/cpp2util.h:839:1: error: lambda-expression in template parameter type + 839 | [LAMBDADEFCAPT]< \ | ^ -../../../include/cpp2util.h:856:59: note: in expansion of macro ‘CPP2_UFCS_’ - 856 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) +../../../include/cpp2util.h:857:59: note: in expansion of macro ‘CPP2_UFCS_’ + 857 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__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:838:1: error: lambda-expression in template parameter type - 838 | [LAMBDADEFCAPT]< \ +../../../include/cpp2util.h:839:1: error: lambda-expression in template parameter type + 839 | [LAMBDADEFCAPT]< \ | ^ -../../../include/cpp2util.h:856:59: note: in expansion of macro ‘CPP2_UFCS_’ - 856 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) +../../../include/cpp2util.h:857:59: note: in expansion of macro ‘CPP2_UFCS_’ + 857 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__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:838:1: error: lambda-expression in template parameter type - 838 | [LAMBDADEFCAPT]< \ +../../../include/cpp2util.h:839:1: error: lambda-expression in template parameter type + 839 | [LAMBDADEFCAPT]< \ | ^ -../../../include/cpp2util.h:856:59: note: in expansion of macro ‘CPP2_UFCS_’ - 856 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__VA_ARGS__) +../../../include/cpp2util.h:857:59: note: in expansion of macro ‘CPP2_UFCS_’ + 857 | #define CPP2_UFCS_NONLOCAL(...) CPP2_UFCS_(,(),,__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-break-continue.cpp.execution b/regression-tests/test-results/gcc-13/pure2-break-continue.cpp.execution index d1e79e5ee6..c8af55771f 100644 --- a/regression-tests/test-results/gcc-13/pure2-break-continue.cpp.execution +++ b/regression-tests/test-results/gcc-13/pure2-break-continue.cpp.execution @@ -8,11 +8,11 @@ while_break_outer: 00 inner 01 do_continue_inner: - 00 inner 01 02 inner 03 inner outer 10 inner 11 12 inner 13 inner outer 20 inner 21 22 inner 23 inner outer 30 inner 31 32 inner 33 inner outer + 00 inner 01 02 inner outer 10 inner 11 12 inner outer 20 inner 21 22 inner outer do_continue_outer: - 00 inner 01 10 inner 11 20 inner 21 30 inner 31 + 00 inner 01 10 inner 11 20 inner 21 do_break_inner: - 00 inner 01 outer 10 inner 11 outer 20 inner 21 outer 30 inner 31 outer + 00 inner 01 outer 10 inner 11 outer 20 inner 21 outer do_break_outer: 00 inner 01 diff --git a/regression-tests/test-results/msvc-2022/mixed-bounds-check.cpp.execution b/regression-tests/test-results/msvc-2022/mixed-bounds-check.cpp.execution index 173634b6ed..5796c96761 100644 --- a/regression-tests/test-results/msvc-2022/mixed-bounds-check.cpp.execution +++ b/regression-tests/test-results/msvc-2022/mixed-bounds-check.cpp.execution @@ -1 +1 @@ -Bounds safety violation: out of bounds access attempt detected +Bounds safety violation: out of bounds access attempt detected - attempted index 5, [min,max] range is [0,4] diff --git a/regression-tests/test-results/msvc-2022/pure2-break-continue.cpp.execution b/regression-tests/test-results/msvc-2022/pure2-break-continue.cpp.execution index d1e79e5ee6..c8af55771f 100644 --- a/regression-tests/test-results/msvc-2022/pure2-break-continue.cpp.execution +++ b/regression-tests/test-results/msvc-2022/pure2-break-continue.cpp.execution @@ -8,11 +8,11 @@ while_break_outer: 00 inner 01 do_continue_inner: - 00 inner 01 02 inner 03 inner outer 10 inner 11 12 inner 13 inner outer 20 inner 21 22 inner 23 inner outer 30 inner 31 32 inner 33 inner outer + 00 inner 01 02 inner outer 10 inner 11 12 inner outer 20 inner 21 22 inner outer do_continue_outer: - 00 inner 01 10 inner 11 20 inner 21 30 inner 31 + 00 inner 01 10 inner 11 20 inner 21 do_break_inner: - 00 inner 01 outer 10 inner 11 outer 20 inner 21 outer 30 inner 31 outer + 00 inner 01 outer 10 inner 11 outer 20 inner 21 outer do_break_outer: 00 inner 01 diff --git a/regression-tests/test-results/pure2-break-continue.cpp b/regression-tests/test-results/pure2-break-continue.cpp index fda2181336..1c16ee0e6f 100644 --- a/regression-tests/test-results/pure2-break-continue.cpp +++ b/regression-tests/test-results/pure2-break-continue.cpp @@ -161,14 +161,14 @@ auto do_continue_inner() -> void std::cout << "inner "; } CPP2_CONTINUE_BREAK(89_9) } #line 89 "pure2-break-continue.cpp2" - while ( + while ( [&]{ #line 96 "pure2-break-continue.cpp2" - cpp2::cmp_less(j,3) && [&]{ ++j ; return true; }() ); + ++j ; return true; }() && cpp2::cmp_less(j,3)); std::cout << "outer "; - } while ( - cpp2::cmp_less(i,3) && [&]{ ++i ; return true; }() ); + } while ( [&]{ + ++i ; return true; }() && cpp2::cmp_less(i,3)); } auto do_continue_outer() -> void @@ -183,16 +183,16 @@ auto do_continue_outer() -> void goto CONTINUE_106_5; } std::cout << "inner "; - } while ( - cpp2::cmp_less(j,3) && [&]{ ++j ; return true; }() ); + } while ( [&]{ + ++j ; return true; }() && cpp2::cmp_less(j,3)); std::cout << "outer "; } CPP2_CONTINUE_BREAK(106_5) } #line 106 "pure2-break-continue.cpp2" - while ( + while ( [&]{ #line 119 "pure2-break-continue.cpp2" - cpp2::cmp_less(i,3) && [&]{ ++i ; return true; }() ); + ++i ; return true; }() && cpp2::cmp_less(i,3)); } auto do_break_inner() -> void @@ -209,14 +209,14 @@ auto do_break_inner() -> void std::cout << "inner "; } CPP2_CONTINUE_BREAK(127_9) } #line 127 "pure2-break-continue.cpp2" - while ( + while ( [&]{ #line 134 "pure2-break-continue.cpp2" - cpp2::cmp_less(j,3) && [&]{ ++j ; return true; }() ); + ++j ; return true; }() && cpp2::cmp_less(j,3)); std::cout << "outer "; - } while ( - cpp2::cmp_less(i,3) && [&]{ ++i ; return true; }() ); + } while ( [&]{ + ++i ; return true; }() && cpp2::cmp_less(i,3)); } auto do_break_outer() -> void @@ -231,16 +231,16 @@ auto do_break_outer() -> void goto BREAK_144_5; } std::cout << "inner "; - } while ( - cpp2::cmp_less(j,3) && [&]{ ++j ; return true; }() ); + } while ( [&]{ + ++j ; return true; }() && cpp2::cmp_less(j,3)); std::cout << "outer "; } CPP2_CONTINUE_BREAK(144_5) } #line 144 "pure2-break-continue.cpp2" - while ( + while ( [&]{ #line 157 "pure2-break-continue.cpp2" - cpp2::cmp_less(i,3) && [&]{ ++i ; return true; }() ); + ++i ; return true; }() && cpp2::cmp_less(i,3)); } auto for_continue_inner() -> void diff --git a/regression-tests/test-results/pure2-intro-example-three-loops.cpp b/regression-tests/test-results/pure2-intro-example-three-loops.cpp index 02bce27abb..1d827be97c 100644 --- a/regression-tests/test-results/pure2-intro-example-three-loops.cpp +++ b/regression-tests/test-results/pure2-intro-example-three-loops.cpp @@ -50,7 +50,7 @@ auto decorate_and_print(auto& thing) -> void{ do { std::cout << std::setw(4) << "**"; - } while ( cpp2::cmp_greater(*cpp2::assert_not_null(i),1) && [&]{ --*cpp2::assert_not_null(i) ; return true; }() ); + } while ( [&]{ --*cpp2::assert_not_null(i) ; return true; }() && cpp2::cmp_greater(*cpp2::assert_not_null(i),0)); std::cout << "\n"; for ( auto& word : words ) diff --git a/regression-tests/test-results/pure2-print.cpp b/regression-tests/test-results/pure2-print.cpp index ecf7323227..d5fa375c84 100644 --- a/regression-tests/test-results/pure2-print.cpp +++ b/regression-tests/test-results/pure2-print.cpp @@ -122,7 +122,7 @@ requires (true) inline CPP2_CONSTEXPR T outer::object_alias = 42; for( ; CPP2_UFCS(empty)(s); a() ) {break; } - do {} while ( CPP2_UFCS(empty)(s) && [&]{ b() ; return true; }() ); + do {} while ( [&]{ b() ; return true; }() && CPP2_UFCS(empty)(s)); for ( [[maybe_unused]] auto const& unnamed_param_1 : m ) { { do {goto CONTINUE_43_13; } while (false); c(); } CPP2_CONTINUE_BREAK(43_13) } diff --git a/regression-tests/test-results/pure2-print.cpp2.output b/regression-tests/test-results/pure2-print.cpp2.output index 04793ee775..17f642bbe3 100644 --- a/regression-tests/test-results/pure2-print.cpp2.output +++ b/regression-tests/test-results/pure2-print.cpp2.output @@ -45,17 +45,17 @@ outer: type = { }; while s.empty() - next a() + next a() { break; } do { } - while s.empty() - next b(); + next b() + while s.empty(); label: for m - next c() + next c() do (in _:) { continue label; @@ -75,7 +75,7 @@ outer: type = c(); } } - assert( true ) + assert( true ); return :() -> move std::string = (s + m[0])$;(); } diff --git a/regression-tests/test-results/version b/regression-tests/test-results/version index 7262cd644a..30b69e453f 100644 --- a/regression-tests/test-results/version +++ b/regression-tests/test-results/version @@ -1,5 +1,5 @@ -cppfront compiler v0.3.0 Build 8C03:1133 +cppfront compiler v0.3.0 Build 8C04:1728 Copyright(c) Herb Sutter All rights reserved SPDX-License-Identifier: CC-BY-NC-ND-4.0 diff --git a/source/build.info b/source/build.info index 4695ffd0c3..7615d52040 100644 --- a/source/build.info +++ b/source/build.info @@ -1 +1 @@ -"8C03:1133" \ No newline at end of file +"8C04:1728" \ No newline at end of file diff --git a/source/parse.h b/source/parse.h index e119864d1a..8453d39dc6 100644 --- a/source/parse.h +++ b/source/parse.h @@ -4480,7 +4480,7 @@ auto pretty_print_visualize(iteration_statement_node const& n, int indent) auto next_expr = std::string{}; if (n.next_expression) { - next_expr += std::string{"\n"} + pre(indent+1) + "next " + pretty_print_visualize(*n.next_expression, indent); + next_expr += std::string{"\n"} + pre(indent) + "next " + pretty_print_visualize(*n.next_expression, indent); } auto stmts = std::string{}; @@ -4508,9 +4508,10 @@ auto pretty_print_visualize(iteration_statement_node const& n, int indent) assert (n.condition); ret += "do " + stmts + + next_expr + "\n" + pre(indent) + "while " + pretty_print_visualize(*n.condition, indent) - + next_expr + ";"; + + ";"; } else { assert (n.range && n.parameter && n.body); @@ -4610,6 +4611,10 @@ auto pretty_print_visualize(contract_node const& n, int indent) ret += " )"; + if (*n.kind == "assert") { + ret += ";"; + } + return ret; } @@ -6644,7 +6649,7 @@ class parser //G iteration-statement: //G label? 'while' logical-or-expression next-clause? compound-statement - //G label? 'do' compound-statement 'while' logical-or-expression next-clause? ';' + //G label? 'do' compound-statement next-clause? 'while' logical-or-expression ';' //G label? 'for' expression next-clause? 'do' unnamed-declaration //G //G label: @@ -6743,13 +6748,13 @@ class parser else if (*n->identifier == "do") { if (!handle_compound_statement ()) { return {}; } + if (!handle_optional_next_clause()) { return {}; } if (curr() != "while") { error("do loop body must be followed by 'while'"); return {}; } next(); if (!handle_logical_expression ()) { return {}; } - if (!handle_optional_next_clause()) { return {}; } if (curr().type() != lexeme::Semicolon) { error("missing ; after do..while loop condition"); next(); diff --git a/source/to_cpp1.h b/source/to_cpp1.h index 5bff9f17ba..7473f43ef5 100644 --- a/source/to_cpp1.h +++ b/source/to_cpp1.h @@ -2205,14 +2205,14 @@ class cppfront printer.print_extra(" CPP2_CONTINUE_BREAK("+labelname+") }"); } printer.print_cpp2(" while ( ", n.position()); - emit(*n.condition); if (n.next_expression) { // Gotta say, this feels kind of nifty... short-circuit eval // and smuggling work into a condition via a lambda, O my... - printer.print_cpp2(" && [&]{ ", n.position()); + printer.print_cpp2("[&]{ ", n.position()); emit(*n.next_expression); - printer.print_cpp2(" ; return true; }() ", n.position()); + printer.print_cpp2(" ; return true; }() && ", n.position()); } + emit(*n.condition); printer.print_cpp2(");", n.position()); } @@ -2231,10 +2231,26 @@ class cppfront // but some major compilers seem to have random troubles with that; // the workaround to avoid their bugs for now is to emit a { } block // around the Cpp1 range-for and make the scope variable a normal local + printer.print_cpp2("for ( ", n.position()); + emit(*n.parameter); + printer.print_cpp2(" : ", n.position()); - emit(*n.range); + + // If this expression is just a single expression-list, we can + // take over direct control of emitting it without needing to + // go through the whole grammar, and surround it with braces + if (n.range->is_expression_list()) { + printer.print_cpp2( "{ ", n.position() ); + emit(*n.range->get_expression_list(), false); + printer.print_cpp2( " }", n.position() ); + } + // Otherwise, just emit the general expression as usual + else { + emit(*n.range); + } + printer.print_cpp2(" ) ", n.position()); if (!labelname.empty()) { printer.print_extra("{");