Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2219920/?format=api
{ "id": 2219920, "url": "http://patchwork.ozlabs.org/api/patches/2219920/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260405123322.3064791-2-ivan.lazaric1@gmail.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/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, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260405123322.3064791-2-ivan.lazaric1@gmail.com>", "list_archive_url": null, "date": "2026-04-05T12:33:23", "name": "libstdc++: Implement P1789R3: structured bindings for std::integer_sequence", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "dc6d23a1df83dbbe26bddb4bc3988c6f4917dcbb", "submitter": { "id": 92628, "url": "http://patchwork.ozlabs.org/api/people/92628/?format=api", "name": "Ivan Lazaric", "email": "ivan.lazaric1@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260405123322.3064791-2-ivan.lazaric1@gmail.com/mbox/", "series": [ { "id": 498779, "url": "http://patchwork.ozlabs.org/api/series/498779/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=498779", "date": "2026-04-05T12:33:23", "name": "libstdc++: Implement P1789R3: structured bindings for std::integer_sequence", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/498779/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2219920/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2219920/checks/", "tags": {}, "related": [], "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=B5pGxXXt;\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=B5pGxXXt", "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.218.48" ], "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 4fpX8d4Kjjz1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 05 Apr 2026 22:39:29 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id D62DB4BA2E29\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 5 Apr 2026 12:39:25 +0000 (GMT)", "from mail-ej1-f48.google.com (mail-ej1-f48.google.com\n [209.85.218.48])\n by sourceware.org (Postfix) with ESMTPS id 4707E4BA2E20\n for <gcc-patches@gcc.gnu.org>; Sun, 5 Apr 2026 12:38:22 +0000 (GMT)", "by mail-ej1-f48.google.com with SMTP id\n a640c23a62f3a-b982b0889d8so422168466b.2\n for <gcc-patches@gcc.gnu.org>; Sun, 05 Apr 2026 05:38:22 -0700 (PDT)", "from ilazaric-gram.arnhem.chello.nl\n (2001-1c00-4c85-8400-bc45-0a59-504a-1b6d.cable.dynamic.v6.ziggo.nl.\n [2001:1c00:4c85:8400:bc45:a59:504a:1b6d])\n by smtp.gmail.com with ESMTPSA id\n a640c23a62f3a-b9c3cff131csm386506966b.52.2026.04.05.05.38.17\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 05 Apr 2026 05:38:18 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org D62DB4BA2E29", "OpenDKIM Filter v2.11.0 sourceware.org 4707E4BA2E20" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 4707E4BA2E20", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 4707E4BA2E20", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775392702; cv=none;\n b=sUeaCjd1iMduq3osXCoj6NzSjNRR+sCZA3c6TdFB5NcxN86oU4+WKxdbeNPDIuORBbmNGrD7NhPZRgF/ujVIN5e6X/xNmEtJW9vCKMwZj0CzZP23QZdc/DMgnvZYGqoItBIq7ZW1k+dMtCCgfFuatiTnlYKlSavJLvM5udTtWaE=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1775392702; c=relaxed/simple;\n bh=E2dY7DrG9dpk2j6sduBSqn8rD90HLXte+vF4Ths2rb8=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=ktH7+0zW5Pf7x3qgR3kGjNDVNAS29DzHnVatTUybycY44oU/Ssq/abKkrD3ClxmEHbgV+Wflv+hm8KtWrwT/LOjPcSHXTMYM8KvsPJJrp3pqo1gdR3dJ95ubdL0o37/EcXtguSsV65NxI/33IO4hw4+TTLhHgWq6GGUBTuuQynk=", "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=1775392700; x=1775997500; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=MHQh1aBJhpVt3T2noMUe2Q3TecNCIrtlTe0bZv6C6hE=;\n b=B5pGxXXtVaxssu+kkBia7vkUI4hYJsqkEP/KiprXQ809iZbrbU7pkIoRcUa96kUXzN\n bQcOfnYVZ8h3FCxvVpVw0X27GQlHOujrN01afmVChfcb5dpJLKRlAcSVtIT0xMQ2V//J\n /hivcEOPjijyB0+uaECK34SoO25aUqFOj9xfIfLQ5pmi063yjsbkk1RYjERU1heC0uel\n F072knpWvfspeoLrBB1ErWOb0ivTibAuvP9QW+nq8wav/a1WS3e8L+A3PGqddE1gcX6T\n haEWs28zFjTcWPMEdIFEDuFXRHbyisc1TCeeu9oxFFzS8G0NhzLicc5evuz5/p+XB0+c\n kOtQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775392700; x=1775997500;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=MHQh1aBJhpVt3T2noMUe2Q3TecNCIrtlTe0bZv6C6hE=;\n b=S1eWzlhXeP5+Gc/tSDpnA05nmVXtxrrq4RvL8XFLesdDkp82osiZ2Bn232fGRnP/E6\n 46nSxYztz8fx+qrgSF5du5xGBFTk/JdypT4ss5HvVzikPGnnTd6boXaBNHpSdJtQGeKO\n 2oslNGeT4C71ZDELWpW0eePVjVdcAqrtqgemeq4WzrzlLSkRW4HCZCyQFtCIscY2NuCp\n eFK4aYRni5zPeX7QG5hm6XntiawjbrOp5GqMzL2CCtSUhWesfORhlbn+Ph3NTBYg9cRb\n qxaxpH01ecCnwd3XgqyWdKs4ht4brNRXF2mqgkT08i/VlgU4B97+6fDvRB5/N/9hfQSY\n VSjA==", "X-Forwarded-Encrypted": "i=1;\n AJvYcCWzkdC/6xp/VYINNo+r6ZoKyM1pc8Ou2IPuo3vJAWaWIi8MvDHF8RmdEteE99ScwlCGEPque5xOoy8NQg==@gcc.gnu.org", "X-Gm-Message-State": "AOJu0YwSiOtYvxnH79QhnyevsD0O8a50Xc/9urWOVIZrTugqZeD/sDfq\n Nj8xcxZywoQWQ6N/6Aot6MSyPeG3yL9iuNIeEM6G1UoY571wXmroxTvB", "X-Gm-Gg": "AeBDietYdXF9FNENf5cO5a2UbThtytePYZZB0Li06dWEXDJJ00vTjBiLM6fzxO0Bbg3\n fY+yWhfY5d3ZG1zg3bDWT9rezXDjCurR1Fcv4DGtJqhYH1VT56cEaiaHiVqShyMlpLFdbdmaPnC\n u58tFG+RhvP1KHJ1hfFjET4YUrsy9wj06C65VFzJnMnywryEy2WzIf4tVpi7z5Rtfn0+J7YXAe0\n TMgOSmG4L03r0bF+btqmjuy7OzE+lf7uCdqze17kts0wmRfyzdif1boP0c7IpI5FN2sXJbnu33/\n JvvJ2FbUerqbJEYIs9q9NzzhDGsrW+CqokUL20CBYg0z8XRb4hZFui9MEQ67mdbiH5aEkOxwEMh\n vrKLL/ocgT9cfjuKb3tnYgS1F5wJRPodMmpBGZjT3efMzo/yFDeVT/5FR7UnzYtzyuDHSTVzwpq\n RoqVJdURLENfKXjwknsHlXgFkTlyrYYzIK1QXJ/QdtNcKx8/TUKwP2FoSH3Kf/5QViOfvqlEJwe\n 1gmoiqbuguS9AwN+5vjEMvWO21389sxNzIzMhpccD1gE+jhII/ul4MjbHnt62Gdaam/8xsFxKWo\n +fZpmndA5DPPtImOKF1KECvEHlSlpNGpMme9hsT2afoma7mw3ZHep6OuokeHexihfL+fufuyy0E\n v1S07", "X-Received": "by 2002:a17:907:e102:b0:b8f:a5c8:f75 with SMTP id\n a640c23a62f3a-b9c67993552mr341773066b.52.1775392700143;\n Sun, 05 Apr 2026 05:38:20 -0700 (PDT)", "From": "Ivan Lazaric <ivan.lazaric1@gmail.com>", "To": "tkaminsk@redhat.com", "Cc": "libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org,\n Ivan Lazaric <ivan.lazaric1@gmail.com>", "Subject": "[PATCH] libstdc++: Implement P1789R3: structured bindings for\n std::integer_sequence", "Date": "Sun, 5 Apr 2026 14:33:23 +0200", "Message-ID": "<20260405123322.3064791-2-ivan.lazaric1@gmail.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "\n <CAKvuMXCT6BdqR2hv3GGbzQEiTyd=nR_127HHFSug97asAQnBbw@mail.gmail.com>", "References": "\n <CAKvuMXCT6BdqR2hv3GGbzQEiTyd=nR_127HHFSug97asAQnBbw@mail.gmail.com>", "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": "https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p1789r3.pdf\n\nP1789 enables accessing the sequence values through structured bindings.\n```\nauto [...values] = std::make_index_sequence<10>{};\n// values is a pack of size 10, and elements 0, 1, 2, ..., 9\n```\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/structured_binding.cc: New test.\n\nSigned-off-by: Ivan Lazaric <ivan.lazaric1@gmail.com>\n---\nFixed a missing `std::` on `size_t` , thanks Linaro.\nExtended the test.\n\nOnly part that fails is the last block in `test_basic()`\nI am pretty sure that's because of:\n```\nstatic constexpr int&& x = 1;\nstatic_assert(x == 1); // fails, would've worked if it was `const int&&` or `const int&`\n```\n\nhttps://godbolt.org/z/jM18sv5nh\n\n libstdc++-v3/include/bits/utility.h | 28 ++++++++\n libstdc++-v3/include/bits/version.def | 5 ++\n libstdc++-v3/include/bits/version.h | 7 +-\n .../integer_sequence/structured_binding.cc | 72 +++++++++++++++++++\n 4 files changed, 111 insertions(+), 1 deletion(-)\n create mode 100644 libstdc++-v3/testsuite/20_util/integer_sequence/structured_binding.cc", "diff": "diff --git a/libstdc++-v3/include/bits/utility.h b/libstdc++-v3/include/bits/utility.h\nindex bd6b18d54dd..159884dd814 100644\n--- a/libstdc++-v3/include/bits/utility.h\n+++ b/libstdc++-v3/include/bits/utility.h\n@@ -150,6 +150,34 @@ _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+ 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+\tstatic_assert(__i < sizeof...(_Idx));\n+\tusing 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+\tstatic_assert(__i < sizeof...(_Idx));\n+\tusing 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+\tstatic_assert(__i < sizeof...(_Idx));\n+\treturn _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 1265f01757c..81ec5723844 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 00f352089f7..cde4fa839db 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/structured_binding.cc b/libstdc++-v3/testsuite/20_util/integer_sequence/structured_binding.cc\nnew file mode 100644\nindex 00000000000..18cbcae53e5\n--- /dev/null\n+++ b/libstdc++-v3/testsuite/20_util/integer_sequence/structured_binding.cc\n@@ -0,0 +1,72 @@\n+// { dg-do compile { target c++26 } }\n+\n+#include <utility>\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+\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+\n+using IS3 = std::integer_sequence<char>;\n+static_assert( std::tuple_size_v<IS3> == 0 );\n+\n+template<typename = void>\n+constexpr bool\n+test_basic()\n+{\n+ {\n+ auto [...elems] = std::make_index_sequence<10>{};\n+\n+ static_assert( sizeof...(elems) == 10 );\n+\n+ VERIFY( elems...[0] == 0 );\n+ VERIFY( elems...[3] == 3 );\n+ VERIFY( elems...[9] == 9 );\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+ // these fail\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+ return true;\n+}\n+\n+static_assert( test_basic() );\n", "prefixes": [] }