Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2221265/?format=api
{ "id": 2221265, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2221265/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260409024128.421442-4-mfwippich@gmail.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.1/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null }, "msgid": "<20260409024128.421442-4-mfwippich@gmail.com>", "date": "2026-04-09T02:41:31", "name": "[v2] libstdc++: Implement structured binding support for integer_sequence", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "8759f215622fb5a25a8eae6a2b7e415621c80fda", "submitter": { "id": 93063, "url": "http://patchwork.ozlabs.org/api/1.1/people/93063/?format=api", "name": "Matthias Wippich", "email": "mfwippich@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260409024128.421442-4-mfwippich@gmail.com/mbox/", "series": [ { "id": 499231, "url": "http://patchwork.ozlabs.org/api/1.1/series/499231/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=499231", "date": "2026-04-09T02:41:31", "name": "[v2] libstdc++: Implement structured binding support for integer_sequence", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/499231/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2221265/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2221265/checks/", "tags": {}, "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 (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=tJQlVp/I;\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 (2048-bit key,\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=tJQlVp/I", "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "sourceware.org; spf=pass smtp.mailfrom=gmail.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=209.85.221.53" ], "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 4frknx3fnmz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 12:45:36 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id D0DE44BA2E1F\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 9 Apr 2026 02:45:28 +0000 (GMT)", "from mail-wr1-f53.google.com (mail-wr1-f53.google.com\n [209.85.221.53])\n by sourceware.org (Postfix) with ESMTPS id 9B51A4BA2E08\n for <gcc-patches@gcc.gnu.org>; Thu, 9 Apr 2026 02:44:40 +0000 (GMT)", "by mail-wr1-f53.google.com with SMTP id\n ffacd0b85a97d-43b99df9649so9510f8f.3\n for <gcc-patches@gcc.gnu.org>; Wed, 08 Apr 2026 19:44:40 -0700 (PDT)", "from localhost\n (p200300ee17060ec5436078a94c3422a3.dip0.t-ipconnect.de.\n [2003:ee:1706:ec5:4360:78a9:4c34:22a3])\n by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-43d1e4f7d4esm55728751f8f.34.2026.04.08.19.44.37\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 08 Apr 2026 19:44:38 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org D0DE44BA2E1F", "OpenDKIM Filter v2.11.0 sourceware.org 9B51A4BA2E08" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 9B51A4BA2E08", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 9B51A4BA2E08", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775702680; cv=none;\n b=BTTPzrz7C9pkonMw4ez6+3yy6qQLnJ7onaJfyZ273WEd+vxiDy0sWPYIUsv8pAqk4+UKI5cFv8Ir6JVk3HLLW5eDNYMd51RAkJkw4j4pfXC8bHCMZJswXhdRczRyhtuVTB1iBzZuP2CzO51GkMiCbJkfApt6arFeYkMpTmtJkVE=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1775702680; c=relaxed/simple;\n bh=m8NM4OfWlOeCn3joijuOzaDdbg8lNuYbjIRkgxiFBa0=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=fO1dEePIpPNHAHUUpEaPEkfwb/Lf7J6u2NE+vgu2epYYqtuXOH0YprtX0a5Q2JAh5vFYi7GU7SGUzcVWJg+zv44PhB+4E+qk83Xbs0uwm7fdgLQ0azWii1ptsKjvBF/muJaFF42tsvpNB8LKhB535faF8KrnyVdZw1Uq0xfQSgI=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775702679; x=1776307479; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=xuDRlhtxZ3tXJ/nXWHIHGN5zAoPmjpK8JEvbxeyU3hY=;\n b=tJQlVp/I3SJA7x8guypTw8sqOdQYgd6mLzr18iObdWH90X9VEouqlVdnBIpYsu0lJG\n cv9XCNqdRW8PluXOmv5yZb8C+dDSZEWMqOZre/+qHjPn0s9qNpmu4VT5544enWbYigBr\n 5YFSr1hPEHobFVizcfRJen953C/7tUwdpLOuq0tihgVv4TKypSndvNyLS7GxIbLv9ral\n s/hazJW3iRJyvN1+f27qSBO+n7GmJXV22hu6LX6zcE5OiJe9VtLtFQOh0HUQR52wVlmU\n zqb3nN4BdleM1iUwX19QW3l1Hm9DPQ3zwAQ9YsONHQI3Sjk8ulT+YnNyiB/2MuG1n45r\n hjHg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775702679; x=1776307479;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=xuDRlhtxZ3tXJ/nXWHIHGN5zAoPmjpK8JEvbxeyU3hY=;\n b=CXtSWX+e2YslK++wY3Z1lhuYNy+RVq3U0IXVr5O326h7tPqLmVHrtSplxnNp8R8Kov\n EPgiJqzjMzv89OfcFTot8g/1bsCME6gcowudyrsLXl+9l7JD8XkhsfDypjxJt7IVrMWa\n 2cYScKaKO3vLA5xNJftAFfJqz0Ioc2ZF2UBkuRdOPzV/gnZPSl3wpX9JjWGLmXG9eBnr\n mP74VnP0y8gpSELGMUIhFQEhSTirSfEIozTh9/pKAp7FvX4Vyq+2MNoXR8nunDsU95yP\n cN8bVDpyyBDwZ1U05fnBLRCkMECQm1rl89vWM2dDvgZs0KzCKkyCBGpLOg5jDFQLM4Bc\n nPNw==", "X-Gm-Message-State": "AOJu0Ywa7jvnURoT2R43OMcbiOxFt5Us00qVG2LDg12ltyOeJosOSZga\n y0r2AFJlmEw6UXsFnkJXH2A94DrH20NCff8rG9SskkYm6nltDSPOMRBFD8x8F4NNKQ==", "X-Gm-Gg": "AeBDievKswXsuDOxUi4fiaW3vUzO8crNQG0vT05iz0DONv74TxiO+aeT61yJIa/e0nG\n KB3ERkUSTmduITt7KHljLb1LtqiB1sHfoVk1aYHypdt6cIkR//2HfaHbcrukOd+tyoUcrArd6Yd\n YUFcb3JzxSVdCRGJj4ZxrlnGV4UKK7AXkMLSYFmw1rkcDwq3V90aPjrVxqZ1HdqDdCIQo9NWiX+\n oQMq1lxol6dC3TJ7PwybeGHrGfGRHguTuWSs0IwR+IYVbzURUqQ4dk2XxbNHzTESSg8L9/I5u+3\n CM4rT9ACTaeSviqB9NEvnKPYw+3B0defxJtQbWGxhSkfy8wsRfrbAiHMzT2VGMXYDYH4GtfcPhS\n 0QXAJVkw6sKaLL2fKJXLUO9dI3h0x49cr6o0LFdxPm/w+vwn37LjTlwFq7rHokH8wTJvRNTaJJX\n muMKnhSz9KpH0gQ1CdjUkCzk4DuQ0rlcJmus8rgW/Bz5Nrr9TeR2ZCxOo3EyxtKvELQdqtnXJQO\n z62C3+zdw==", "X-Received": "by 2002:a05:6000:2d02:b0:43d:19f:89 with SMTP id\n ffacd0b85a97d-43d58e2d91dmr924386f8f.8.1775702679262;\n Wed, 08 Apr 2026 19:44:39 -0700 (PDT)", "From": "Matthias Wippich <mfwippich@gmail.com>", "To": "libstdc++@gcc.gnu.org", "Cc": "gcc-patches@gcc.gnu.org, Matthias Wippich <mfwippich@gmail.com>,\n Ivan Lazaric <ivan.lazaric1@gmail.com>", "Subject": "[PATCH v2] libstdc++: Implement structured binding support for\n integer_sequence", "Date": "Thu, 9 Apr 2026 04:41:31 +0200", "Message-ID": "<20260409024128.421442-4-mfwippich@gmail.com>", "X-Mailer": "git-send-email 2.53.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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" }, "content": "This implements P1789R3 Library Support for Expansion Statements.\nhttps://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p1789r3.pdf\n\nCorresponding C++ draft commit: 3d71a838ed2a1689dd329f964ec4d58152487151\nFeature-test macro integer_sequence has been bumped to 202511L.\n\nlibstdc++-v3/ChangeLog:\n\n\t* include/bits/utility.h:\n Implement structured bindings protocol for std::integer_sequence.\n\t* include/bits/version.def: Bump integer_sequence feature-test macro.\n\t* include/bits/version.h: Regenerate.\n\t* testsuite/20_util/integer_sequence/tuple_access.cc: New test.\n\t* testsuite/20_util/integer_sequence/tuple_access_neg.cc: New test.\n\nCo-authored-by: Ivan Lazaric <ivan.lazaric1@gmail.com>\nSigned-off-by: Matthias Wippich <mfwippich@gmail.com>\n---\n libstdc++-v3/include/bits/utility.h | 30 ++++++\n libstdc++-v3/include/bits/version.def | 5 +\n libstdc++-v3/include/bits/version.h | 7 +-\n .../20_util/integer_sequence/tuple_access.cc | 96 +++++++++++++++++++\n .../integer_sequence/tuple_access_neg.cc | 21 ++++\n 5 files changed, 158 insertions(+), 1 deletion(-)\n create mode 100644 libstdc++-v3/testsuite/20_util/integer_sequence/tuple_access.cc\n create mode 100644 libstdc++-v3/testsuite/20_util/integer_sequence/tuple_access_neg.cc", "diff": "diff --git a/libstdc++-v3/include/bits/utility.h b/libstdc++-v3/include/bits/utility.h\nindex 93e9e9f9dba..363aed478c5 100644\n--- a/libstdc++-v3/include/bits/utility.h\n+++ b/libstdc++-v3/include/bits/utility.h\n@@ -481,6 +481,36 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n static constexpr size_t size() noexcept { return sizeof...(_Idx); }\n };\n \n+#if __glibcxx_integer_sequence >= 202511L // C++ >= 26\n+\n+ /// Structured binding support\n+ template<typename _Tp, _Tp... _Idx>\n+ struct tuple_size<integer_sequence<_Tp, _Idx...>>\n+ : integral_constant<size_t, sizeof...(_Idx)> { };\n+\n+ template<size_t __i, class _Tp, _Tp... _Idx>\n+ struct tuple_element<__i, integer_sequence<_Tp, _Idx...>>\n+ {\n+ static_assert(__i < sizeof...(_Idx));\n+ using type = _Tp;\n+ };\n+\n+ template<size_t __i, class _Tp, _Tp... _Idx>\n+ struct tuple_element<__i, const integer_sequence<_Tp, _Idx...>>\n+ {\n+ static_assert(__i < sizeof...(_Idx));\n+ using type = _Tp;\n+ };\n+\n+ template<size_t __i, class _Tp, _Tp... _Idx>\n+ constexpr _Tp\n+ get (integer_sequence<_Tp, _Idx...>) noexcept\n+ {\n+ static_assert(__i < sizeof...(_Idx));\n+ return _Idx...[__i];\n+ }\n+#endif // __glibcxx_integer_sequence >= 202511L\n+\n /// Alias template make_integer_sequence\n template<typename _Tp, _Tp _Num>\n using make_integer_sequence\ndiff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def\nindex cfb90533ce4..8db3c1d2df3 100644\n--- a/libstdc++-v3/include/bits/version.def\n+++ b/libstdc++-v3/include/bits/version.def\n@@ -184,6 +184,11 @@ ftms = {\n \n ftms = {\n name = integer_sequence;\n+ values = {\n+ v = 202511;\n+ cxxmin = 26;\n+ extra_cond = \"__cpp_pack_indexing\";\n+ };\n values = {\n v = 201304;\n cxxmin = 14;\ndiff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h\nindex 22dd31b9d32..455d7190e90 100644\n--- a/libstdc++-v3/include/bits/version.h\n+++ b/libstdc++-v3/include/bits/version.h\n@@ -186,7 +186,12 @@\n #undef __glibcxx_want_exchange_function\n \n #if !defined(__cpp_lib_integer_sequence)\n-# if (__cplusplus >= 201402L)\n+# if (__cplusplus > 202302L) && (__cpp_pack_indexing)\n+# define __glibcxx_integer_sequence 202511L\n+# if defined(__glibcxx_want_all) || defined(__glibcxx_want_integer_sequence)\n+# define __cpp_lib_integer_sequence 202511L\n+# endif\n+# elif (__cplusplus >= 201402L)\n # define __glibcxx_integer_sequence 201304L\n # if defined(__glibcxx_want_all) || defined(__glibcxx_want_integer_sequence)\n # define __cpp_lib_integer_sequence 201304L\ndiff --git a/libstdc++-v3/testsuite/20_util/integer_sequence/tuple_access.cc b/libstdc++-v3/testsuite/20_util/integer_sequence/tuple_access.cc\nnew file mode 100644\nindex 00000000000..a942d1d8396\n--- /dev/null\n+++ b/libstdc++-v3/testsuite/20_util/integer_sequence/tuple_access.cc\n@@ -0,0 +1,96 @@\n+// { dg-do compile { target c++26 } }\n+\n+#include <utility>\n+#include <tuple>\n+#include <testsuite_hooks.h>\n+\n+#if __cpp_lib_integer_sequence < 202511L\n+# error \"Feature-test macro __cpp_lib_integer_sequence is incorrect\"\n+#endif\n+\n+constexpr auto\n+destructure_sum(auto seq)\n+{\n+ auto [...elems] = seq;\n+ return (0 + ... + elems);\n+}\n+\n+using IS1 = std::make_index_sequence<10>;\n+static_assert( std::tuple_size_v<IS1> == 10 );\n+static_assert( std::is_same_v<std::tuple_element_t<3, IS1>, std::size_t> );\n+static_assert( std::get<7>(IS1{}) == 7 );\n+static_assert( destructure_sum(IS1{}) == 45 );\n+static_assert( noexcept(get<0>(IS1{})) );\n+\n+using IS2 = std::integer_sequence<int, 42, 101, -13>;\n+static_assert( std::tuple_size_v<IS2> == 3 );\n+static_assert( std::is_same_v<std::tuple_element_t<1, IS2>, int> );\n+static_assert( std::get<2>(IS2{}) == -13 );\n+static_assert( destructure_sum(IS2{}) == 130 );\n+static_assert( noexcept(get<0>(IS2{})) );\n+\n+using IS3 = std::integer_sequence<char>;\n+static_assert( std::tuple_size_v<IS3> == 0 );\n+\n+using IS4 = std::integer_sequence<int, 1, 2>;\n+static_assert( !std::is_constructible_v<std::pair<int, int>, IS4> );\n+static_assert( !std::is_constructible_v<std::tuple<int, int>, IS4> );\n+\n+template<typename = void>\n+constexpr bool\n+test_basic()\n+{\n+ {\n+ auto [...elems] = std::make_index_sequence<0>{};\n+ static_assert( sizeof...(elems) == 0 );\n+ }\n+\n+ {\n+ auto [...elems] = std::integer_sequence<int, 3, 5, 7, 11>{};\n+\n+ static_assert( sizeof...(elems) == 4 );\n+\n+ VERIFY( elems...[0] == 3 );\n+ VERIFY( elems...[1] == 5 );\n+ VERIFY( elems...[2] == 7 );\n+ VERIFY( elems...[3] == 11 );\n+ }\n+\n+ {\n+ static constexpr auto [...elems] = std::integer_sequence<short, 2, 4, 8, 16>{};\n+\n+ static_assert( sizeof...(elems) == 4 );\n+\n+ static_assert( elems...[0] == 2 );\n+ static_assert( elems...[1] == 4 );\n+ static_assert( elems...[2] == 8 );\n+ static_assert( elems...[3] == 16 );\n+ }\n+\n+ {\n+ constexpr auto [...elems] = std::integer_sequence<int, 1, 8, 2, 11>{};\n+\n+ static_assert( sizeof...(elems) == 4 );\n+\n+ static_assert( elems...[0] == 1 );\n+ static_assert( elems...[1] == 8 );\n+ static_assert( elems...[2] == 2 );\n+ static_assert( elems...[3] == 11 );\n+ }\n+\n+ /* Unimplemented, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117784\n+ {\n+ auto idx = 0;\n+ template for (constexpr auto elem : std::make_index_sequence<4>{})\n+ {\n+\tVERIFY( elem == idx );\n+\t++idx;\n+ }\n+ VERIFY( idx == 4 );\n+ }\n+ */\n+\n+ return true;\n+}\n+\n+static_assert( test_basic() );\ndiff --git a/libstdc++-v3/testsuite/20_util/integer_sequence/tuple_access_neg.cc b/libstdc++-v3/testsuite/20_util/integer_sequence/tuple_access_neg.cc\nnew file mode 100644\nindex 00000000000..42c57620e91\n--- /dev/null\n+++ b/libstdc++-v3/testsuite/20_util/integer_sequence/tuple_access_neg.cc\n@@ -0,0 +1,21 @@\n+// { dg-do compile { target c++26 } }\n+\n+#include <utility>\n+\n+using empty = std::integer_sequence<int>;\n+static_assert( std::is_same_v<std::tuple_element_t<0, empty>, int> ); // { dg-error \"here\" }\n+static_assert( std::is_same_v<std::tuple_element_t<0, const empty>, int> ); // { dg-error \"here\" }\n+\n+using size4 = std::integer_sequence<int, 1, 9, 7, 15>;\n+static_assert( std::is_same_v<std::tuple_element_t<4, size4>, int> ); // { dg-error \"here\" }\n+static_assert( std::is_same_v<std::tuple_element_t<4, const size4>, int> ); // { dg-error \"here\" }\n+\n+void\n+test() \n+{\n+ (void)std::get<0>(empty{}); // { dg-error \"here\" } \n+ (void)std::get<4>(size4{}); // { dg-error \"here\" } \n+}\n+\n+// { dg-error \"static assertion failed\" \"\" { target *-*-* } 0 }\n+// { dg-excess-errors \"\" }\n", "prefixes": [ "v2" ] }