Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Changes in regression-tests adding _for_break variable (#1436)
  • Loading branch information
Kevin Egan committed Nov 29, 2025
commit 51f0bb80812b819291df91dff1c907753151cd3c
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ auto add_42_to_subrange(auto& rng, cpp2::impl::in<int> start, cpp2::impl::in<int
auto count {0};
for (

auto& i : rng ) { do
auto& i : rng ) { bool _for_break = false; do
if ([_0 = start, _1 = count, _2 = end]{ return cpp2::impl::cmp_less_eq(_0,_1) && cpp2::impl::cmp_less_eq(_1,_2); }()) {
i += 42;
} while (false); ++count; }
} while (false); if (_for_break) { break; } ++count; }
}

Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ auto print_subrange(auto const& rng, cpp2::impl::in<int> start, cpp2::impl::in<i
auto count {0};
for (

auto const& i : rng ) { do
auto const& i : rng ) { bool _for_break = false; do
if (cpp2::impl::cmp_less_eq(start,count) && cpp2::impl::cmp_less_eq(count,end)) {
std::cout << i << "\n";
} while (false); ++count; }
} while (false); if (_for_break) { break; } ++count; }
}

Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
{
std::vector<int> v {1, 2, 3, 4, 5};
auto counter {42};
for ( auto const& i : cpp2::move(v) ) { do {
for ( auto const& i : cpp2::move(v) ) { bool _for_break = false; do {
std::cout << i << " " << counter << "\n";
} while (false); counter *= 2; }
} while (false); if (_for_break) { break; } counter *= 2; }
}

4 changes: 2 additions & 2 deletions regression-tests/test-results/pure2-autodiff-higher-order.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ std::vector<cpp2::taylor<double,6>> v_d {};
r = 0.0;
{
auto t_d_iter{CPP2_UFCS(begin)(cpp2::move(v_d))};
for ( auto const& t : cpp2::move(v) ) { do {
for ( auto const& t : cpp2::move(v) ) { bool _for_break = false; do {
{
auto const& t_d{*cpp2::impl::assert_not_null(t_d_iter)};
{
Expand All @@ -981,7 +981,7 @@ auto const& t_d{*cpp2::impl::assert_not_null(t_d_iter)};
}
}
}
while (false); (++t_d_iter); }
while (false); if (_for_break) { break; } (++t_d_iter); }
}
return { std::move(r), std::move(r_d) };
}
Expand Down
4 changes: 2 additions & 2 deletions regression-tests/test-results/pure2-autodiff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ std::vector<double> v_d {};
r = 0.0;
{
auto t_d_iter{CPP2_UFCS(begin)(cpp2::move(v_d))};
for ( auto const& t : cpp2::move(v) ) { do {
for ( auto const& t : cpp2::move(v) ) { bool _for_break = false; do {
{
auto const& t_d{*cpp2::impl::assert_not_null(t_d_iter)};
{
Expand All @@ -1195,7 +1195,7 @@ auto const& t_d{*cpp2::impl::assert_not_null(t_d_iter)};
}
}
}
while (false); (++t_d_iter); }
while (false); if (_for_break) { break; } (++t_d_iter); }
}
return { std::move(r), std::move(r_d) };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ auto main(int const argc_, char** argv_) -> int{

for ( auto const& i : [_0 = args]() mutable -> decltype(auto) { return _0; }() ) static_cast<void>(i);
for ( auto const& j : [](auto&& x) -> decltype(auto) { return CPP2_FORWARD(x); }(args) ) static_cast<void>(j);
for ( auto const& k : [](auto&& x) -> decltype(auto) { return CPP2_FORWARD(x); }(args) ) { do static_cast<void>(k); while (false); static_cast<void>([_0 = args]() mutable -> decltype(auto) { return _0; }()); }
for ( auto const& l : [](auto&& x) -> decltype(auto) { return CPP2_FORWARD(x); }(args) ) { do static_cast<void>(l); while (false); static_cast<void>([](auto&& x) -> decltype(auto) { return x; }(args)); }
for ( auto const& k : [](auto&& x) -> decltype(auto) { return CPP2_FORWARD(x); }(args) ) { bool _for_break = false; do static_cast<void>(k); while (false); if (_for_break) { break; } static_cast<void>([_0 = args]() mutable -> decltype(auto) { return _0; }()); }
for ( auto const& l : [](auto&& x) -> decltype(auto) { return CPP2_FORWARD(x); }(args) ) { bool _for_break = false; do static_cast<void>(l); while (false); if (_for_break) { break; } static_cast<void>([](auto&& x) -> decltype(auto) { return x; }(args)); }
}

4 changes: 2 additions & 2 deletions regression-tests/test-results/pure2-last-use.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1393,8 +1393,8 @@ auto loops() -> void{
auto x {cpp2_new<int>(0)};
for (

[[maybe_unused]] auto const& unnamed_param_1 : { 0 } ) { do
{} while (false); f_inout(x); }
[[maybe_unused]] auto const& unnamed_param_1 : { 0 } ) { bool _for_break = false; do
{} while (false); if (_for_break) { break; } f_inout(x); }
});

static_cast<void>([]() -> void{
Expand Down
2 changes: 1 addition & 1 deletion regression-tests/test-results/pure2-print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ requires (true) inline CPP2_CONSTEXPR T outer::object_alias{ 42 };

do {} while ( [&]{ b() ; return true; }() && CPP2_UFCS(empty)(s));

for ( [[maybe_unused]] auto const& unnamed_param_1 : m ) { { do {goto CONTINUE_label; } while (false); c(); } CPP2_CONTINUE_BREAK(label) }
for ( [[maybe_unused]] auto const& unnamed_param_1 : m ) { { bool _for_break = false; do {goto CONTINUE_label; } while (false); if (_for_break) { break; } c(); } CPP2_CONTINUE_BREAK(label) }

#line 47 "pure2-print.cpp2"
if (cpp2::impl::is(!(CPP2_UFCS(empty)(s)), (true))) {cpp2::move(a)(); }
Expand Down