[{"id":3678937,"web_url":"http://patchwork.ozlabs.org/comment/3678937/","msgid":"<6c56e77d-5d4f-f02c-9323-cd03024df001@idea>","list_archive_url":null,"date":"2026-04-18T01:59:29","subject":"Re: [PATCH] libstdc++: Fix constantness of engaged -> disengaged\n std::optional [PR124910]","submitter":{"id":78319,"url":"http://patchwork.ozlabs.org/api/people/78319/","name":"Patrick Palka","email":"ppalka@redhat.com"},"content":"On Fri, 17 Apr 2026, Patrick Palka wrote:\n\n> Tested on x86_64-pc-linux-gnu, does this look OK for trunk?  Perhaps\n> backports as well?\n> \n> -- >8 --\n> \n> We implement std::optional<T> for trivially destructible T as a union\n> with an empty dummy member (_M_empty) indicating the disengaged state.\n> When we disengage such an std::optional that's already engaged we call\n> _M_destroy, which clears the _M_engaged flag and invokes the contained\n> objects's destructor, ending the lifetime of the corresponding union\n> member (_M_value) and leaving the union with no active member.  While\n> benign at runtime, a union subobject with no active member violates\n> core constant expression requirements.  Consequently the resulting\n> value can't be used as a constant initializer, which Clang and recent\n> GCC (r16-3022) correctly diagnose.\n> \n> To fix this, this patch makes _M_destroy activate the _M_empty union\n> member after ending the destroying and deactivating _M_value.  We use\n> std::construct_at instead of simple assignment to work around a front\n> end bug (see comment #6 of the PR).\n> \n> \tPR c++/124910\n> \n> libstdc++-v3/ChangeLog:\n> \n> \t* include/std/optional (_Optional_payload_base::_M_destroy):\n> \tDuring constant evaluation, after invoking destructor of\n> \t_M_value, call construct_at to activate _M_empty.\n> \t* testsuite/20_util/optional/constexpr/124910.cc: New test.\n> ---\n>  libstdc++-v3/include/std/optional             |  2 +\n>  .../20_util/optional/constexpr/124910.cc      | 63 +++++++++++++++++++\n>  2 files changed, 65 insertions(+)\n>  create mode 100644 libstdc++-v3/testsuite/20_util/optional/constexpr/124910.cc\n> \n> diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional\n> index 0f4cf0bd1ef6..0524222eab97 100644\n> --- a/libstdc++-v3/include/std/optional\n> +++ b/libstdc++-v3/include/std/optional\n> @@ -321,6 +321,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n>        {\n>  \t_M_engaged = false;\n>  \t_M_payload._M_value.~_Stored_type();\n> +\tif (std::__is_constant_evaluated())\n> +\t  std::construct_at(std::__addressof(_M_payload._M_empty));\n\nWhoops, forgot to test with GLIBCXX_TESTSUITE_STDS that includes 17.\nconstruct_at is C++20-only, and so is full constexpr optional support.\nSo we should guard this added code with __cpp_lib_optional >= 202106L\nlike so.  Retesting thoroughly overnight...\n\n-- >8 --\n\n\tPR c++/124910\n\nlibstdc++-v3/ChangeLog:\n\n\t* include/std/optional (_Optional_payload_base::_M_destroy)\n\t[__cpp_lib_optional >= 202106L]: During constant evaluation,\n\tafter invoking destructor of _M_value, call construct_at to\n\tactivate _M_empty.\n\t* testsuite/20_util/optional/constexpr/124910.cc: New test.\n---\n libstdc++-v3/include/std/optional             |  4 ++\n .../20_util/optional/constexpr/124910.cc      | 63 +++++++++++++++++++\n 2 files changed, 67 insertions(+)\n create mode 100644 libstdc++-v3/testsuite/20_util/optional/constexpr/124910.cc\n\ndiff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional\nindex 0f4cf0bd1ef6..8370fac08109 100644\n--- a/libstdc++-v3/include/std/optional\n+++ b/libstdc++-v3/include/std/optional\n@@ -321,6 +321,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n       {\n \t_M_engaged = false;\n \t_M_payload._M_value.~_Stored_type();\n+#if __cpp_lib_optional >= 202106L // full constexpr support\n+\tif (std::is_constant_evaluated())\n+\t  std::construct_at(std::__addressof(_M_payload._M_empty));\n+#endif\n       }\n \n #if __cplusplus >= 202002L\ndiff --git a/libstdc++-v3/testsuite/20_util/optional/constexpr/124910.cc b/libstdc++-v3/testsuite/20_util/optional/constexpr/124910.cc\nnew file mode 100644\nindex 000000000000..f7facdec020d\n--- /dev/null\n+++ b/libstdc++-v3/testsuite/20_util/optional/constexpr/124910.cc\n@@ -0,0 +1,63 @@\n+// { dg-do compile { target c++20 } }\n+\n+// PR124910 - bogus 'std::optional{...}' is not a constant expression error\n+// after resetting it via '= nullopt'\n+\n+#include <optional>\n+\n+struct A {\n+  constexpr A(int m) : m(m) { }\n+  int m;\n+};\n+\n+struct B {\n+  constexpr B(int m) : m(m) { }\n+  constexpr ~B() { }\n+  int m;\n+};\n+\n+static_assert(   std::is_trivially_destructible_v<int> );\n+static_assert(   std::is_trivially_destructible_v<A> );\n+static_assert( ! std::is_trivially_destructible_v<B> );\n+\n+template<class T>\n+void do_test() {\n+  constexpr std::optional<T> x1 = [] {\n+    std::optional<T> o = 1;\n+    o = std::nullopt;\n+    return o;\n+  }();\n+\n+  constexpr std::optional<T> x2 = [] {\n+    std::optional<T> o = 1;\n+    o.reset();\n+    return o;\n+  }();\n+\n+  constexpr std::optional<T> x3 = [] {\n+    std::optional<T> o1 = 1;\n+    std::optional<long> o2;\n+    o1 = o2;\n+    return o1;\n+  }();\n+\n+  constexpr std::optional<T> x4 = [] {\n+    std::optional<T> o1 = 1;\n+    std::optional<long> o2;\n+    o1 = std::move(o2);\n+    return o1;\n+  }();\n+\n+  constexpr std::optional<T> x5 = [] {\n+    std::optional<T> o1 = 1;\n+    std::optional<T> o2;\n+    std::swap(o1, o2);\n+    return o1;\n+  }();\n+}\n+\n+int main() {\n+  do_test<int>();\n+  do_test<A>();\n+  do_test<B>();\n+}","headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=Tm98HMop;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=Tm98HMop","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","sourceware.org; spf=pass smtp.mailfrom=redhat.com","server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.129.124"],"Received":["from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fyFLx3mjZz1yDF\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 12:00:08 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 01DDA4CD201D\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 02:00:06 +0000 (GMT)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id 9C2E54AA3969\n for <gcc-patches@gcc.gnu.org>; Sat, 18 Apr 2026 01:59:33 +0000 (GMT)","from mail-qk1-f200.google.com (mail-qk1-f200.google.com\n [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-265-xDOdr-a8MQynRBkII6Bc2w-1; Fri, 17 Apr 2026 21:59:31 -0400","by mail-qk1-f200.google.com with SMTP id\n af79cd13be357-8d56ae62e86so37669185a.0\n for <gcc-patches@gcc.gnu.org>; Fri, 17 Apr 2026 18:59:31 -0700 (PDT)","from [2600:4040:aa66:bf00:9e8e:99ff:fed1:71f]\n ([2600:4040:aa66:bf00:9e8e:99ff:fed1:71f])\n by smtp.gmail.com with ESMTPSA id\n 6a1803df08f44-8b02ac4513asm23329066d6.1.2026.04.17.18.59.29\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 17 Apr 2026 18:59:30 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 01DDA4CD201D","OpenDKIM Filter v2.11.0 sourceware.org 9C2E54AA3969"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 9C2E54AA3969","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 9C2E54AA3969","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776477573; cv=none;\n b=ShtnUGi+8ojTjd/H51LsTK71eI4g+38PLJP5IfoUuUWhX9J/kOIQ5aT6nWgAOTy3CVQUIohiC+c2GIiJ0vsQnCBYx2WNtqPvqZ90VKUN7zAMfEcmjN0Fnf4J3heCdey5UFZ5akQQX7zP1Eq590Lsp+S3DwsQkBdH4bs0RCcnLfE=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776477573; c=relaxed/simple;\n bh=DM99/lT/JHvwQ2O9zbundZOj1cFMR4F3+VDr0JNis7E=;\n h=DKIM-Signature:From:Date:To:Subject:Message-ID:MIME-Version;\n b=dbOx3uednXYA3NrwdQyLEoClvnjewzLZS2OZGQk4dmDNpGospGqy6fXHb8/3aLwFfUM3UNSoAKJrDLJFnab/9s4WITjdH2/yQcsErRyzYC95KHM7HGY5w4862B+YcFRONnggbAuhpsH1YQSj1MErGMaa9CNaUTX4ezKKRZMn0JU=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776477573;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n in-reply-to:in-reply-to:references:references;\n bh=Rt08n6gYHC2p8b54oM+t/u4JvML1SoBy6levHk9L//U=;\n b=Tm98HMopn/lfyIAw65V4HVWxUKunf5PVPfvyVFnjfQwDf9qAUs4v8w8RnsAfmyBy/RIAcH\n QJXEpQLl1zjQPJtBIiprisbREm9guMMagPx+le2nx2ZIzlQsx3kIHcNYUNbrwm024Xo22n\n kVz8N7TzotmQhD7cQfzHCQheho5uKnA=","X-MC-Unique":"xDOdr-a8MQynRBkII6Bc2w-1","X-Mimecast-MFC-AGG-ID":"xDOdr-a8MQynRBkII6Bc2w_1776477571","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776477571; x=1777082371;\n h=mime-version:references:message-id:in-reply-to:subject:cc:to:date\n :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=Rt08n6gYHC2p8b54oM+t/u4JvML1SoBy6levHk9L//U=;\n b=Snst+bXBnLueVUEgdGPh5mrANFQkoj+4x+m2OM4odH5LUCXIhaenZF4JQyYjPOfZM5\n +PeWtt5xAZTTBgpfHWJSTiLQXmCW/pjMx/Sub/gTKIjWoCktAxbgcVKKs/QHXQ6qIYWV\n reY0PSBOHcmrZk2uq9qXwla4scQL32jZc+eTLsJQtgQCUhnaGf+aMu0+4p8BNF1uu6RW\n +5+gtAV1Tj/PvVONjh3Y4Em2Cq2c/3g6VuupeNfHwp8Vt3I7CQPDpNY5ota2js7TXiTN\n gotTNEw7AnjDp7LwmzCE/rGlx4CL4dU042lD4MnivmSkduwAxTQpIEV0LCos9G+hCawx\n iqKw==","X-Gm-Message-State":"AOJu0YxlP0Mtis1J79UfAJCQdC0ez102BwmWjCVv3DzJadDSzgXz4qXp\n nlCJvCLMsYBAd4PBhIs89j/UrcW4yJaYXHVesJEpy1K5XuYOk13PYTkpo5klZgJpksbkiF5OuQH\n YSXdfWhzPnGhAdknt1ObRPZxNu4r+nfvhtbj/1LT2VmRaJw+HTdcWB+toGmQ=","X-Gm-Gg":"AeBDieuIFfs8yVl+R5gejsf8gCKwzRkEYQdotZodgM+NS7p1rgCQEnMlnIGBOpkLpgR\n u+HZ2BTlyx96knQpbq4RjOTRIVO52cYP5+K1pFIeNqCsC0obmSDE6di6Kt7ypvzn5mWkRouXzhl\n Rr3csSz3brbqAElTtSwvM/O8toRTMw773OscdmoFoee90qdoaWUl13kX1insJSU5YpuX8aGhcXj\n KjpsP1yFRGMl3LLBSl4SAJmhosDi6ypJt+nAdIp2TvA/fD+4k78XBkUCUtmZTxv7r2UIrejYG0R\n /v0whInOqO6IhkBRzmKoS7WFgQAH2CkmjRP4uOxuBllYSl6gosfcviI/FIgBPERPuTzb5iVH5x6\n 5bbZwt2NM6DqPk4TYA3RfP8+SVObPie5yzLgz9PXR3K1fq05sUn4sQULBPKCSl+p2","X-Received":["by 2002:ad4:5b85:0:b0:8ac:b9e7:a95d with SMTP id\n 6a1803df08f44-8b0281482dcmr57666256d6.6.1776477571113;\n Fri, 17 Apr 2026 18:59:31 -0700 (PDT)","by 2002:ad4:5b85:0:b0:8ac:b9e7:a95d with SMTP id\n 6a1803df08f44-8b0281482dcmr57666146d6.6.1776477570656;\n Fri, 17 Apr 2026 18:59:30 -0700 (PDT)"],"From":"Patrick Palka <ppalka@redhat.com>","X-Google-Original-From":"Patrick Palka <patrick@idea>","Date":"Fri, 17 Apr 2026 21:59:29 -0400 (EDT)","To":"Patrick Palka <ppalka@redhat.com>","cc":"gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org, jason@redhat.com","Subject":"Re: [PATCH] libstdc++: Fix constantness of engaged -> disengaged\n std::optional [PR124910]","In-Reply-To":"<20260418014405.1242458-1-ppalka@redhat.com>","Message-ID":"<6c56e77d-5d4f-f02c-9323-cd03024df001@idea>","References":"<20260418014405.1242458-1-ppalka@redhat.com>","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"hGGLLlq59zZaIYoBeH_zSHWxkSSGqn-gPjnPvzVE4aQ_1776477571","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=US-ASCII","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"}},{"id":3678938,"web_url":"http://patchwork.ozlabs.org/comment/3678938/","msgid":"<dce287e2-f28d-d07f-f00e-fd7fdf9ddbb3@idea>","list_archive_url":null,"date":"2026-04-18T02:25:50","subject":"Re: [PATCH] libstdc++: Fix constantness of engaged -> disengaged\n std::optional [PR124910]","submitter":{"id":78319,"url":"http://patchwork.ozlabs.org/api/people/78319/","name":"Patrick Palka","email":"ppalka@redhat.com"},"content":"On Fri, 17 Apr 2026, Patrick Palka wrote:\n\n> On Fri, 17 Apr 2026, Patrick Palka wrote:\n> \n> > Tested on x86_64-pc-linux-gnu, does this look OK for trunk?  Perhaps\n> > backports as well?\n> > \n> > -- >8 --\n> > \n> > We implement std::optional<T> for trivially destructible T as a union\n> > with an empty dummy member (_M_empty) indicating the disengaged state.\n> > When we disengage such an std::optional that's already engaged we call\n> > _M_destroy, which clears the _M_engaged flag and invokes the contained\n> > objects's destructor, ending the lifetime of the corresponding union\n> > member (_M_value) and leaving the union with no active member.  While\n> > benign at runtime, a union subobject with no active member violates\n> > core constant expression requirements.  Consequently the resulting\n> > value can't be used as a constant initializer, which Clang and recent\n> > GCC (r16-3022) correctly diagnose.\n> > \n> > To fix this, this patch makes _M_destroy activate the _M_empty union\n> > member after ending the destroying and deactivating _M_value.  We use\n> > std::construct_at instead of simple assignment to work around a front\n> > end bug (see comment #6 of the PR).\n> > \n> > \tPR c++/124910\n> > \n> > libstdc++-v3/ChangeLog:\n> > \n> > \t* include/std/optional (_Optional_payload_base::_M_destroy):\n> > \tDuring constant evaluation, after invoking destructor of\n> > \t_M_value, call construct_at to activate _M_empty.\n> > \t* testsuite/20_util/optional/constexpr/124910.cc: New test.\n> > ---\n> >  libstdc++-v3/include/std/optional             |  2 +\n> >  .../20_util/optional/constexpr/124910.cc      | 63 +++++++++++++++++++\n> >  2 files changed, 65 insertions(+)\n> >  create mode 100644 libstdc++-v3/testsuite/20_util/optional/constexpr/124910.cc\n> > \n> > diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional\n> > index 0f4cf0bd1ef6..0524222eab97 100644\n> > --- a/libstdc++-v3/include/std/optional\n> > +++ b/libstdc++-v3/include/std/optional\n> > @@ -321,6 +321,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n> >        {\n> >  \t_M_engaged = false;\n> >  \t_M_payload._M_value.~_Stored_type();\n> > +\tif (std::__is_constant_evaluated())\n> > +\t  std::construct_at(std::__addressof(_M_payload._M_empty));\n> \n> Whoops, forgot to test with GLIBCXX_TESTSUITE_STDS that includes 17.\n> construct_at is C++20-only, and so is full constexpr optional support.\n> So we should guard this added code with __cpp_lib_optional >= 202106L\n> like so.  Retesting thoroughly overnight...\n\nIn C++17 optional was only partially constexpr, supporting only simple\nconstruction and assignment, and I don't think we can end up with an\noptional in such a state using only those operations.  So it should be\nfine to use construct_at and restrict ourselves to C++20, I think.\n\n> \n> -- >8 --\n> \n> \tPR c++/124910\n> \n> libstdc++-v3/ChangeLog:\n> \n> \t* include/std/optional (_Optional_payload_base::_M_destroy)\n> \t[__cpp_lib_optional >= 202106L]: During constant evaluation,\n> \tafter invoking destructor of _M_value, call construct_at to\n> \tactivate _M_empty.\n> \t* testsuite/20_util/optional/constexpr/124910.cc: New test.\n> ---\n>  libstdc++-v3/include/std/optional             |  4 ++\n>  .../20_util/optional/constexpr/124910.cc      | 63 +++++++++++++++++++\n>  2 files changed, 67 insertions(+)\n>  create mode 100644 libstdc++-v3/testsuite/20_util/optional/constexpr/124910.cc\n> \n> diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional\n> index 0f4cf0bd1ef6..8370fac08109 100644\n> --- a/libstdc++-v3/include/std/optional\n> +++ b/libstdc++-v3/include/std/optional\n> @@ -321,6 +321,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n>        {\n>  \t_M_engaged = false;\n>  \t_M_payload._M_value.~_Stored_type();\n> +#if __cpp_lib_optional >= 202106L // full constexpr support\n> +\tif (std::is_constant_evaluated())\n> +\t  std::construct_at(std::__addressof(_M_payload._M_empty));\n> +#endif\n>        }\n>  \n>  #if __cplusplus >= 202002L\n> diff --git a/libstdc++-v3/testsuite/20_util/optional/constexpr/124910.cc b/libstdc++-v3/testsuite/20_util/optional/constexpr/124910.cc\n> new file mode 100644\n> index 000000000000..f7facdec020d\n> --- /dev/null\n> +++ b/libstdc++-v3/testsuite/20_util/optional/constexpr/124910.cc\n> @@ -0,0 +1,63 @@\n> +// { dg-do compile { target c++20 } }\n> +\n> +// PR124910 - bogus 'std::optional{...}' is not a constant expression error\n> +// after resetting it via '= nullopt'\n> +\n> +#include <optional>\n> +\n> +struct A {\n> +  constexpr A(int m) : m(m) { }\n> +  int m;\n> +};\n> +\n> +struct B {\n> +  constexpr B(int m) : m(m) { }\n> +  constexpr ~B() { }\n> +  int m;\n> +};\n> +\n> +static_assert(   std::is_trivially_destructible_v<int> );\n> +static_assert(   std::is_trivially_destructible_v<A> );\n> +static_assert( ! std::is_trivially_destructible_v<B> );\n> +\n> +template<class T>\n> +void do_test() {\n> +  constexpr std::optional<T> x1 = [] {\n> +    std::optional<T> o = 1;\n> +    o = std::nullopt;\n> +    return o;\n> +  }();\n> +\n> +  constexpr std::optional<T> x2 = [] {\n> +    std::optional<T> o = 1;\n> +    o.reset();\n> +    return o;\n> +  }();\n> +\n> +  constexpr std::optional<T> x3 = [] {\n> +    std::optional<T> o1 = 1;\n> +    std::optional<long> o2;\n> +    o1 = o2;\n> +    return o1;\n> +  }();\n> +\n> +  constexpr std::optional<T> x4 = [] {\n> +    std::optional<T> o1 = 1;\n> +    std::optional<long> o2;\n> +    o1 = std::move(o2);\n> +    return o1;\n> +  }();\n> +\n> +  constexpr std::optional<T> x5 = [] {\n> +    std::optional<T> o1 = 1;\n> +    std::optional<T> o2;\n> +    std::swap(o1, o2);\n> +    return o1;\n> +  }();\n> +}\n> +\n> +int main() {\n> +  do_test<int>();\n> +  do_test<A>();\n> +  do_test<B>();\n> +}\n> -- \n> 2.54.0.rc1.54.g60f07c4f5c\n> \n>","headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=eqVo71U8;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=eqVo71U8","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","sourceware.org; spf=pass smtp.mailfrom=redhat.com","server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.129.124"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fyFxH6Vtwz1yGt\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 12:26:26 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 81DE54CCCA18\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 02:26:23 +0000 (GMT)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id 850154CCCA07\n for <gcc-patches@gcc.gnu.org>; Sat, 18 Apr 2026 02:25:55 +0000 (GMT)","from mail-qk1-f200.google.com (mail-qk1-f200.google.com\n [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-209-pqvQNSpJNuOOHSosXIt9TA-1; Fri, 17 Apr 2026 22:25:52 -0400","by mail-qk1-f200.google.com with SMTP id\n af79cd13be357-8d56ae62e86so38231085a.0\n for <gcc-patches@gcc.gnu.org>; Fri, 17 Apr 2026 19:25:52 -0700 (PDT)","from [2600:4040:aa66:bf00:9e8e:99ff:fed1:71f]\n ([2600:4040:aa66:bf00:9e8e:99ff:fed1:71f])\n by smtp.gmail.com with ESMTPSA id\n af79cd13be357-8e7d5fe9638sm252209985a.1.2026.04.17.19.25.50\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 17 Apr 2026 19:25:50 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 81DE54CCCA18","OpenDKIM Filter v2.11.0 sourceware.org 850154CCCA07"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 850154CCCA07","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 850154CCCA07","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776479155; cv=none;\n b=YZ47zq7lx7TMVYTih3jVC2WR8/hw6YnvSbKzkONKMnGnizPRBYo430a6ILB/Vc7QpYa5vppUgpWK+7aTGaEASgFPnetbaMksChSH7O9t0Wj4Lt6M4S+tFEfYjkoioNCHMUuIrFq/5ZcbF6uMf5F3MTvsNRkZ/RrZt2tPj5TSxHs=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776479155; c=relaxed/simple;\n bh=7Ebeq4wUrVXA3vf6rHjF6VTR3H7NJtWpD2dVXpKXRvs=;\n h=DKIM-Signature:From:Date:To:Subject:Message-ID:MIME-Version;\n b=Qqd9/ZiTD2RUsDxZN20BmixjVxMMYSi5TnNolMcBVHe2DAu4iQ2gPTe+PQv6tIKavWEcqe9H6wh0lJejJXdDPRPiYk74DP5H57dsufrt+ZrFJk3D8/0dLGUvPsZI+a4kKHFcxDOdOKJkP+prn0k7CqP6y5S4OFVOzcJ+tJ32YXI=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776479154;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n in-reply-to:in-reply-to:references:references;\n bh=CBwMIBTym0ypZ+nZzT//bC+kVT52u5EjbJki1U32dkM=;\n b=eqVo71U8vVPbBElH0eVlTFF1HQEkOtwtFObJMZbcA+VXAYhZ/K562dYd168AsZRd/TS0dJ\n pGa3ItBSBKj/41W8tGpLp01HQNyjCUyZ3P6U6jB8oGFjuR3CfXReErCDY840wZfyO/Y5ox\n sj9w9mpNUNzKLfFx1Q23DCp6s5FVWig=","X-MC-Unique":"pqvQNSpJNuOOHSosXIt9TA-1","X-Mimecast-MFC-AGG-ID":"pqvQNSpJNuOOHSosXIt9TA_1776479152","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776479152; x=1777083952;\n h=mime-version:references:message-id:in-reply-to:subject:cc:to:date\n :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=CBwMIBTym0ypZ+nZzT//bC+kVT52u5EjbJki1U32dkM=;\n b=jP9yKRiGEUTdMRKvi7B6F07SUIo3AU7KBX/J1x20EU7u22Xk/ij8EAKXJtZP+Ydrt5\n Uxg9rI0Byq+mxEXdlYCxMJnE2CY5+M895jtA9QgjPI8cP7PkH5u8mSjEIWqInIiiJbAx\n bfgrijw7BS1FPLLyc6UAehFEQcia7fW//h2mvVo1ajrgp3NzcuRhE37MXZAftqw4N6Oa\n uPeDH/8fG0qjfDI0Z2Cy1GUbYcEzcGVikMAGvd3z1y7GaGPNikusCitNyPFlN/n0885A\n LfY6f8U61HDLwxnf3O3t05rTS/iV/jZ2Of2xxDjpCpoSxrmgEnr5YZ8+k1bBw0lcY0sI\n 2z1g==","X-Gm-Message-State":"AOJu0Yy5dySXTqxC72f6qPPSU4o53tHZuZTS9xbJCqqO5YgJz7bF9/ZT\n M6Jt4TrRDkaytVoS6lVzkjxCSvHWLgRVu7B88R0OehCkituX+7QxVWFC645RNYHFERqnhBFFXR9\n pmE/vtYXJ+p0GWe2juejmdTJ7U8QvLIEskpNmBiLai7OeEaHuA4eJBVcmt74=","X-Gm-Gg":"AeBDietxVEwMpWRI6q3znqFXSjuN/6eRcS7yj2diGts4L9aRa1RZtng+W0WG9mTX34t\n kCIblBy465hKppKw3ICVyd2ePbJIXKHr1UFpdNgWKVKb8+247PCp6k2TW4qVgSXmLFROl1bTm7r\n DSSGWVdnACP3+YLgMCbsJKr7M/lrZSRJiyMvVhY7WLwQimA+3KD0AIoILM8zgSUMyqWQhAVx91E\n sR4u2WIflcTMWq27AmlF6ZCrbR4zGM8zWktL5VIRlANiVTy6H0MEFqId7EdjX/1Y463xVXmmkDE\n 7jdpdRVcwWibF811P/tCg/yzKNxkjRZkpLEjJvX+X+yioC49hDR/Y16vJ8rvsLxnPY2xqTJyoX+\n c4ZaIDoLOmv2iQ4R7EzCX4qfcovfl9knRk6QT2mMq+mgVS5dlu/Ld/0PnNRA5LgfA","X-Received":["by 2002:a05:620a:1a1e:b0:8cf:df8b:1e6b with SMTP id\n af79cd13be357-8e78f154cf7mr557476885a.1.1776479151842;\n Fri, 17 Apr 2026 19:25:51 -0700 (PDT)","by 2002:a05:620a:1a1e:b0:8cf:df8b:1e6b with SMTP id\n af79cd13be357-8e78f154cf7mr557476085a.1.1776479151348;\n Fri, 17 Apr 2026 19:25:51 -0700 (PDT)"],"From":"Patrick Palka <ppalka@redhat.com>","X-Google-Original-From":"Patrick Palka <patrick@idea>","Date":"Fri, 17 Apr 2026 22:25:50 -0400 (EDT)","To":"Patrick Palka <ppalka@redhat.com>","cc":"gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org, jason@redhat.com","Subject":"Re: [PATCH] libstdc++: Fix constantness of engaged -> disengaged\n std::optional [PR124910]","In-Reply-To":"<6c56e77d-5d4f-f02c-9323-cd03024df001@idea>","Message-ID":"<dce287e2-f28d-d07f-f00e-fd7fdf9ddbb3@idea>","References":"<20260418014405.1242458-1-ppalka@redhat.com>\n <6c56e77d-5d4f-f02c-9323-cd03024df001@idea>","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"wg2AXFnQhH6KnvEWjfb_LiejE8-FbRCj4Ude0GaCkKg_1776479152","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=US-ASCII","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"}},{"id":3678961,"web_url":"http://patchwork.ozlabs.org/comment/3678961/","msgid":"<CACb0b4=PQ10j7ArJ7djVrqAAdru-VjqUTAmpaQi0iiGWQePpHQ@mail.gmail.com>","list_archive_url":null,"date":"2026-04-18T11:51:49","subject":"Re: [PATCH] libstdc++: Fix constantness of engaged -> disengaged\n std::optional [PR124910]","submitter":{"id":48004,"url":"http://patchwork.ozlabs.org/api/people/48004/","name":"Jonathan Wakely","email":"jwakely@redhat.com"},"content":"On Sat, 18 Apr 2026 at 03:00, Patrick Palka <ppalka@redhat.com> wrote:\n>\n> On Fri, 17 Apr 2026, Patrick Palka wrote:\n>\n> > Tested on x86_64-pc-linux-gnu, does this look OK for trunk?  Perhaps\n> > backports as well?\n> >\n> > -- >8 --\n> >\n> > We implement std::optional<T> for trivially destructible T as a union\n> > with an empty dummy member (_M_empty) indicating the disengaged state.\n> > When we disengage such an std::optional that's already engaged we call\n> > _M_destroy, which clears the _M_engaged flag and invokes the contained\n> > objects's destructor, ending the lifetime of the corresponding union\n> > member (_M_value) and leaving the union with no active member.  While\n> > benign at runtime, a union subobject with no active member violates\n> > core constant expression requirements.  Consequently the resulting\n> > value can't be used as a constant initializer, which Clang and recent\n> > GCC (r16-3022) correctly diagnose.\n> >\n> > To fix this, this patch makes _M_destroy activate the _M_empty union\n> > member after ending the destroying and deactivating _M_value.  We use\n\n\"after ending the destroying and deactivating\" seems to have got garbled.\n\nOK for trunk with that corrected.\n\n> > std::construct_at instead of simple assignment to work around a front\n> > end bug (see comment #6 of the PR).\n> >\n> >       PR c++/124910\n> >\n> > libstdc++-v3/ChangeLog:\n> >\n> >       * include/std/optional (_Optional_payload_base::_M_destroy):\n> >       During constant evaluation, after invoking destructor of\n> >       _M_value, call construct_at to activate _M_empty.\n> >       * testsuite/20_util/optional/constexpr/124910.cc: New test.\n> > ---\n> >  libstdc++-v3/include/std/optional             |  2 +\n> >  .../20_util/optional/constexpr/124910.cc      | 63 +++++++++++++++++++\n> >  2 files changed, 65 insertions(+)\n> >  create mode 100644 libstdc++-v3/testsuite/20_util/optional/constexpr/124910.cc\n> >\n> > diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional\n> > index 0f4cf0bd1ef6..0524222eab97 100644\n> > --- a/libstdc++-v3/include/std/optional\n> > +++ b/libstdc++-v3/include/std/optional\n> > @@ -321,6 +321,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n> >        {\n> >       _M_engaged = false;\n> >       _M_payload._M_value.~_Stored_type();\n> > +     if (std::__is_constant_evaluated())\n> > +       std::construct_at(std::__addressof(_M_payload._M_empty));\n>\n> Whoops, forgot to test with GLIBCXX_TESTSUITE_STDS that includes 17.\n> construct_at is C++20-only, and so is full constexpr optional support.\n> So we should guard this added code with __cpp_lib_optional >= 202106L\n> like so.  Retesting thoroughly overnight...\n>\n> -- >8 --\n>\n>         PR c++/124910\n>\n> libstdc++-v3/ChangeLog:\n>\n>         * include/std/optional (_Optional_payload_base::_M_destroy)\n>         [__cpp_lib_optional >= 202106L]: During constant evaluation,\n>         after invoking destructor of _M_value, call construct_at to\n>         activate _M_empty.\n>         * testsuite/20_util/optional/constexpr/124910.cc: New test.\n> ---\n>  libstdc++-v3/include/std/optional             |  4 ++\n>  .../20_util/optional/constexpr/124910.cc      | 63 +++++++++++++++++++\n>  2 files changed, 67 insertions(+)\n>  create mode 100644 libstdc++-v3/testsuite/20_util/optional/constexpr/124910.cc\n>\n> diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional\n> index 0f4cf0bd1ef6..8370fac08109 100644\n> --- a/libstdc++-v3/include/std/optional\n> +++ b/libstdc++-v3/include/std/optional\n> @@ -321,6 +321,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n>        {\n>         _M_engaged = false;\n>         _M_payload._M_value.~_Stored_type();\n> +#if __cpp_lib_optional >= 202106L // full constexpr support\n> +       if (std::is_constant_evaluated())\n> +         std::construct_at(std::__addressof(_M_payload._M_empty));\n> +#endif\n>        }\n>\n>  #if __cplusplus >= 202002L\n> diff --git a/libstdc++-v3/testsuite/20_util/optional/constexpr/124910.cc b/libstdc++-v3/testsuite/20_util/optional/constexpr/124910.cc\n> new file mode 100644\n> index 000000000000..f7facdec020d\n> --- /dev/null\n> +++ b/libstdc++-v3/testsuite/20_util/optional/constexpr/124910.cc\n> @@ -0,0 +1,63 @@\n> +// { dg-do compile { target c++20 } }\n> +\n> +// PR124910 - bogus 'std::optional{...}' is not a constant expression error\n> +// after resetting it via '= nullopt'\n> +\n> +#include <optional>\n> +\n> +struct A {\n> +  constexpr A(int m) : m(m) { }\n> +  int m;\n> +};\n> +\n> +struct B {\n> +  constexpr B(int m) : m(m) { }\n> +  constexpr ~B() { }\n> +  int m;\n> +};\n> +\n> +static_assert(   std::is_trivially_destructible_v<int> );\n> +static_assert(   std::is_trivially_destructible_v<A> );\n> +static_assert( ! std::is_trivially_destructible_v<B> );\n> +\n> +template<class T>\n> +void do_test() {\n> +  constexpr std::optional<T> x1 = [] {\n> +    std::optional<T> o = 1;\n> +    o = std::nullopt;\n> +    return o;\n> +  }();\n> +\n> +  constexpr std::optional<T> x2 = [] {\n> +    std::optional<T> o = 1;\n> +    o.reset();\n> +    return o;\n> +  }();\n> +\n> +  constexpr std::optional<T> x3 = [] {\n> +    std::optional<T> o1 = 1;\n> +    std::optional<long> o2;\n> +    o1 = o2;\n> +    return o1;\n> +  }();\n> +\n> +  constexpr std::optional<T> x4 = [] {\n> +    std::optional<T> o1 = 1;\n> +    std::optional<long> o2;\n> +    o1 = std::move(o2);\n> +    return o1;\n> +  }();\n> +\n> +  constexpr std::optional<T> x5 = [] {\n> +    std::optional<T> o1 = 1;\n> +    std::optional<T> o2;\n> +    std::swap(o1, o2);\n> +    return o1;\n> +  }();\n> +}\n> +\n> +int main() {\n> +  do_test<int>();\n> +  do_test<A>();\n> +  do_test<B>();\n> +}\n> --\n> 2.54.0.rc1.54.g60f07c4f5c\n>","headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=iIegRYkk;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=iIegRYkk","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","sourceware.org; spf=pass smtp.mailfrom=redhat.com","server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.129.124"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fyVVr69Ccz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 21:52:51 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 5AE584D108DB\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 11:52:48 +0000 (GMT)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id 1F6424B920BF\n for <gcc-patches@gcc.gnu.org>; Sat, 18 Apr 2026 11:52:09 +0000 (GMT)","from mail-yx1-f71.google.com (mail-yx1-f71.google.com\n [74.125.224.71]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-7-XxWjLxv3N_G5rfVYuWua_A-1; Sat, 18 Apr 2026 07:52:06 -0400","by mail-yx1-f71.google.com with SMTP id\n 956f58d0204a3-64eb0bbab48so3318418d50.1\n for <gcc-patches@gcc.gnu.org>; Sat, 18 Apr 2026 04:52:06 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 5AE584D108DB","OpenDKIM Filter v2.11.0 sourceware.org 1F6424B920BF"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 1F6424B920BF","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 1F6424B920BF","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776513134; cv=none;\n b=I2VHiPvwEOO9JExrUfu3Ptog4weTuKSogjQD2c/FZmu2IO1RhfLlGtIrpnJ4PeyaBjdTpwwvJYAXWAb9/klFeXr6S7uM1Hc7aIDUQ33ERIMW8Z/qUsMxCmw03skp2NpIIbl8MzBEsNo3nYPs3aGClVUVFhteNPqtSgqbYec+Iwo=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776513134; c=relaxed/simple;\n bh=EaDgMLkPREzsS3BYbdolTrO9eCoD9rlFOiIMmWAtJSI=;\n h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;\n b=AWwkr3LKafJmlbJUTRbji4NmtCbD7nboCHfR1pNX2nw//bByKb/Rx7YImwWltfnNybMUHBZEh4Ue6v0ROiOxX1zF7y9OnznTL8OPEbkJ9iUYhIYP86ppgK1M9eIuVG0UTXINYZC9onsdtrGJssLIEDoVI7p2iVQAoyIWb1sqR9E=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776513128;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n in-reply-to:in-reply-to:references:references;\n bh=DhjMKIb1hyMght7nNGnqPlsnYXEqr7l8KaVY1uw/tCg=;\n b=iIegRYkkegadOm0/uE/BYV1sTeaEL/lyZRkJhLL9ukxRdWiSxABkTETSBN+je9gVWQymbE\n O78JDXzFLZ4tf6X7ZKTYFJfFUkj+5sjgtF9sneOjWmnQXcbdrxTKCB/NyHdlh3Yp6pHvBH\n bdIo9bXvKXVJy6pwdYaUU1VK4gUEWYM=","X-MC-Unique":"XxWjLxv3N_G5rfVYuWua_A-1","X-Mimecast-MFC-AGG-ID":"XxWjLxv3N_G5rfVYuWua_A_1776513126","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776513126; x=1777117926;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=DhjMKIb1hyMght7nNGnqPlsnYXEqr7l8KaVY1uw/tCg=;\n b=lFmUNNLQHQJRODoEgBLXmocdaeMueWvbyc5j8RHB2u4i+Yum4PbE6unc85KxxWAPDm\n EYnmsAEyKY5e9C9V7D79f3ai6HOnogQM3ZajGjbWuEncjGibk4OtB8Nv0P/UVFQc+5VM\n F4jt7zHGIFZVR5LIZN0ugQtf7dPZApxYj5zrpL1DiJjNQ4ZqiCneAkORO3iF2ZSZSfmc\n VwHzTu+mJNfHPkmNYxkc88FEe9ULYG5r1G89T8vHYOPbnTSnhlWttJBF400m4EgsZQEK\n 3zFre4ZsLVJNQhk1Ji0Pj5QzCzQZtBpBsbnjnVQcMFsXn0VGYOUz5z2kga+xWxK2CIrT\n 69Tw==","X-Gm-Message-State":"AOJu0Yxi+QJ7b339tiAcR+VqJ6Tc+yIViDcQuv+83xkbt9JwLwseHam5\n syoLffXIZeB3VKB4ESlGmUphPpoYHY/13nxcf1HiSYEuoX2576go2dZml/74fzQnq8wCKM6QTRq\n 9eTYSlbKVFyCzcXjtv1ejS9NQnXNmaRntYVpBYYIQg3IEDSr/ca5jQgaepVFVqKJYgqnOHyciNZ\n HF+7lObPpRN2DHUlrd/ueQu3bF5o6wFsf9wQ==","X-Gm-Gg":"AeBDiesi/cM29JrKisDgvhHqe4PUBDujxQJrN13EkAB6w4qu0hv+cfcxhVF/SqEfkGi\n 7qT0WhtJhE7RBR507ewj7yOfhtWFQpfcQRfHbluOz7WA0oDovw3cOBjt2p53ksBT5DdVbsKyWEp\n l11vulKrFWLfdyaWpY/PteecYK5P9xrEtB92JH8lBAvRUTyV0RDBJvRqbDughhoKqATGJnA1OPa\n bllDb+edNbMW3NLVhhPYJv6y1jZYlwR/DEdg5wPUTFZPd3HDTzv0Sq0MqLuOiRV9oDoB1FBzJg+\n gg==","X-Received":["by 2002:a05:690e:c48:b0:651:bad2:1eda with SMTP id\n 956f58d0204a3-65311c6834cmr4612005d50.44.1776513126107;\n Sat, 18 Apr 2026 04:52:06 -0700 (PDT)","by 2002:a05:690e:c48:b0:651:bad2:1eda with SMTP id\n 956f58d0204a3-65311c6834cmr4611996d50.44.1776513125644; Sat, 18 Apr 2026\n 04:52:05 -0700 (PDT)"],"MIME-Version":"1.0","References":"<20260418014405.1242458-1-ppalka@redhat.com>\n <6c56e77d-5d4f-f02c-9323-cd03024df001@idea>","In-Reply-To":"<6c56e77d-5d4f-f02c-9323-cd03024df001@idea>","From":"Jonathan Wakely <jwakely@redhat.com>","Date":"Sat, 18 Apr 2026 12:51:49 +0100","X-Gm-Features":"AQROBzBSmwCXFmjQm0XnDOFGjIrx8LjFuzKQHq1iMZxyULlsJ7OhMqvHT1AY3xM","Message-ID":"\n <CACb0b4=PQ10j7ArJ7djVrqAAdru-VjqUTAmpaQi0iiGWQePpHQ@mail.gmail.com>","Subject":"Re: [PATCH] libstdc++: Fix constantness of engaged -> disengaged\n std::optional [PR124910]","To":"Patrick Palka <ppalka@redhat.com>","Cc":"gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org, jason@redhat.com","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"57PW6osrbwuEKIgqSy3XXyxWPgxQJTxAgvZl4XXY888_1776513126","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=\"UTF-8\"","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"}}]