{"id":2226314,"url":"http://patchwork.ozlabs.org/api/1.2/covers/2226314/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/cover/bmm.hhubxss5wg.gcc.gcc-TEST.peppe.34.1.0@forge-stage.sourceware.org/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/projects/17/?format=json","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":"<bmm.hhubxss5wg.gcc.gcc-TEST.peppe.34.1.0@forge-stage.sourceware.org>","list_archive_url":null,"date":"2026-04-22T10:50:42","name":"[v1,0/1] WIP: libstdc++: implement tuple protocol for std::complex (P2819R2)","submitter":{"id":93222,"url":"http://patchwork.ozlabs.org/api/1.2/people/93222/?format=json","name":"peppe via Sourceware Forge","email":"forge-bot+peppe@forge-stage.sourceware.org"},"mbox":"http://patchwork.ozlabs.org/project/gcc/cover/bmm.hhubxss5wg.gcc.gcc-TEST.peppe.34.1.0@forge-stage.sourceware.org/mbox/","series":[{"id":500993,"url":"http://patchwork.ozlabs.org/api/1.2/series/500993/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=500993","date":"2026-04-22T10:50:42","name":"WIP: libstdc++: implement tuple protocol for std::complex (P2819R2)","version":1,"mbox":"http://patchwork.ozlabs.org/series/500993/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/covers/2226314/comments/","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 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; dmarc=none (p=none dis=none)\n header.from=forge-stage.sourceware.org","sourceware.org;\n spf=pass smtp.mailfrom=forge-stage.sourceware.org","server2.sourceware.org;\n arc=none smtp.remote-ip=38.145.34.39"],"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 4g0xkB544Yz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 21:26:10 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 2DD4D4347081\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 11:26:08 +0000 (GMT)","from forge-stage.sourceware.org (vm08.sourceware.org [38.145.34.39])\n by sourceware.org (Postfix) with ESMTPS id F382744983C4\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 10:51:39 +0000 (GMT)","from forge-stage.sourceware.org (localhost [IPv6:::1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256)\n (No client certificate requested)\n by forge-stage.sourceware.org (Postfix) with ESMTPS id CD2DA42BDF\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 10:51:39 +0000 (UTC)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 2DD4D4347081","OpenDKIM Filter v2.11.0 sourceware.org F382744983C4"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org F382744983C4","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org F382744983C4","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776855100; cv=none;\n b=mIfxkMgDuWQMmw+m9s1e9AR4NUBtwnUL9fXGz5iiuTTtTW2V2opHAgM3iF/tiLaCfGT+slPbBSxWESRvbPdTWzw6fpj+iWRpw3jdJvwwJFApDVo0p1k0tTzCu8vicYi0DuvQS7s08HCp0OL6KGo8+Io/bJSIjL/czN4+hmQgThE=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776855100; c=relaxed/simple;\n bh=Vt0w/t62vsnBqeR2JOEJ8LZ+As6N/1wZkkgE3uCvA0k=;\n h=From:Date:Subject:To:Message-ID;\n b=AdaRt9ZbH4JLaYtubwRTl+qXj0mznlDYxY1Pso0SxfunQW/9LwIak2jb4nNU6YkSh0euoE3VnGnFU4MO3kZYhKYJL0a8n9XCueAv66yQ8iIsdW6wPs4lpGR3K9fKJ0wZKEIFlkGHbHDKCv9+3vYfIwPrEzQrRLZs9ETy9nXZarg=","ARC-Authentication-Results":"i=1; server2.sourceware.org","From":"peppe via Sourceware Forge <forge-bot+peppe@forge-stage.sourceware.org>","Date":"Wed, 22 Apr 2026 10:50:42 +0000","Subject":"[PATCH v1 0/1] WIP: libstdc++: implement tuple protocol for\n std::complex (P2819R2)","To":"gcc-patches mailing list <gcc-patches@gcc.gnu.org>","Message-ID":"\n <bmm.hhubxss5wg.gcc.gcc-TEST.peppe.34.1.0@forge-stage.sourceware.org>","X-Mailer":"batrachomyomachia","X-Pull-Request-Organization":"gcc","X-Pull-Request-Repository":"gcc-TEST","X-Pull-Request":"https://forge.sourceware.org/gcc/gcc-TEST/pulls/34","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>","Reply-To":"gcc-patches mailing list <gcc-patches@gcc.gnu.org>,\n peppe@noreply.localhost","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"},"content":"Hi gcc-patches mailing list,\npeppe via Sourceware Forge <forge-bot+peppe@forge-stage.sourceware.org> has requested that the following forgejo pull request\nbe published on the mailing list.\n\nCreated on: 2025-03-01 15:41:27+00:00\nLatest update: 2025-08-13 03:34:18+00:00\nChanges: 0 changed files, 0 additions, 0 deletions\nHead revision: peppe/gcc-TEST ref refs/pull/34/head commit 601a2df924b7bd13b21c7ee1af3f4531313a2409\nBase revision: gcc/gcc-TEST ref trunk commit 556e25f0e9abc720c940994bd9a1491062933d49 r15-7829-g556e25f0e9abc7\nMerge base: 556e25f0e9abc720c940994bd9a1491062933d49\nFull diff url: https://forge.sourceware.org/gcc/gcc-TEST/pulls/34.diff\nDiscussion:  https://forge.sourceware.org/gcc/gcc-TEST/pulls/34\nRequested Reviewers:\n\nThis commit implements P2819R2 for C++26, making std::complex\ndestructurable and tuple-like (see [complex.tuple]).\n\nstd::get needs to get forward declared in stl_pair.h (following the\nexisting precedent for the implementation of P2165R4, cf.\nr14-8710-g65b4cba9d6a9ff), and implemented in `<complex>`.\n\nAlso, std::get(complex<T>) needs to return *references* to the real and\nimaginary parts of a std::complex object, honoring the value category\nand constness of the argument. In principle a straightforward task, it\ngets a bit convoluted by the fact that:\n\n1) std::complex does not have existing getters that one can use for this\n(real() and imag() return values, not references);\n\n2) there are specializations for language/extended floating-point types,\nwhich requires some duplication -- need to amend the primary and all\nthe specializations;\n\n3) these specializations use a `__complex__ T`, but the primary template\nuses two non-static data members, making generic code harder to write.\n\nThe implementation choice used here is to add the overloads of std::get\nfor complex as declared in [complex.tuple]. In turn they dispatch to\nnewly added getters that extract references to the real/imaginary parts\nof a complex<T>. These getters are private API and the implementation\ndepends on whether it's the primary (bind the data member) or a\nspecialization (use the GCC language extensions for __complex__).\n\nAdd a test that covers the aspects of the tuple protocol, as well as the\ntuple-like interface. While at it, add a test for the existing\ntuple-like feature-testing macro.\n\n```\n\tPR libstdc++/113310\n\nlibstdc++-v3/ChangeLog:\n\n    * include/bits/stl_pair.h (get): Forward-declare std::get for\n    std::complex.\n    * include/bits/version.def (tuple_like): Bump the value of\n    the feature-testing macro in C++26.\n    * include/bits/version.h: Regenerate.\n    * include/std/complex: Implement the tuple protocol for\n    std::complex.\n    (tuple_size): Specialize for std::complex.\n    (tuple_element): Ditto.\n    (__is_tuple_like_v): Ditto.\n    (complex): Add getters to obtain references to the real and\n    imaginary part, on the primary class template and on its\n    specializations.\n    (get): Add the overload of std::get for std::complex.\n    * testsuite/20_util/tuple/tuple_like_ftm.cc: New test.\n    * testsuite/26_numerics/complex/tuple_like.cc: New test.\n```\n\n\nChanged files:\n- A: libstdc++-v3/testsuite/20_util/tuple/tuple_like_ftm.cc\n- A: libstdc++-v3/testsuite/26_numerics/complex/tuple_like.cc\n- M: libstdc++-v3/include/bits/stl_pair.h\n- M: libstdc++-v3/include/bits/version.def\n- M: libstdc++-v3/include/bits/version.h\n- M: libstdc++-v3/include/std/complex\n\n\nGiuseppe D'Angelo (1):\n  libstdc++: implement tuple protocol for std::complex (P2819R2)\n\n libstdc++-v3/include/bits/stl_pair.h          |  18 ++\n libstdc++-v3/include/bits/version.def         |   5 +\n libstdc++-v3/include/bits/version.h           |   7 +-\n libstdc++-v3/include/std/complex              |  91 +++++++++\n .../testsuite/20_util/tuple/tuple_like_ftm.cc |  17 ++\n .../26_numerics/complex/tuple_like.cc         | 179 ++++++++++++++++++\n 6 files changed, 316 insertions(+), 1 deletion(-)\n create mode 100644 libstdc++-v3/testsuite/20_util/tuple/tuple_like_ftm.cc\n create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/tuple_like.cc"}