ctx->global->put_value (new_ctx.object, new_ctx.ctor);
ctx = &new_ctx;
}
+
+ /* If the initializer is complex, evaluate it to initialize slot. */
+ bool is_complex = target_expr_needs_replace (t);
+ if (is_complex)
+ /* In case no initialization actually happens, clear out any
+ void_node from a previous evaluation. */
+ ctx->global->put_value (slot, NULL_TREE);
+
/* Pass vc_prvalue because this indicates
initialization of a temporary. */
r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 1), vc_prvalue,
non_constant_p, overflow_p);
if (*non_constant_p)
break;
- /* If the initializer is complex, evaluate it to initialize slot. */
- bool is_complex = target_expr_needs_replace (t);
if (!is_complex)
{
r = unshare_constructor (r);
--- /dev/null
+// PR c++/120684
+// { dg-do compile { target c++20 } }
+
+struct basic_string {
+ constexpr ~basic_string() {}
+};
+template <typename _Vp> struct lazy_split_view {
+ _Vp _M_base;
+ constexpr int* begin() { return nullptr; }
+ constexpr int* end() { return nullptr; }
+};
+constexpr void test_with_piping() {
+ basic_string input;
+ for (auto e : lazy_split_view(input))
+ ;
+}
+constexpr bool main_test() {
+ test_with_piping();
+ test_with_piping();
+ return true;
+}
+//int main() { main_test(); }
+static_assert(main_test());