{"id":2226645,"url":"http://patchwork.ozlabs.org/api/covers/2226645/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/cover/bmm.hhundg5lhq.gcc.gcc-TEST.peppe.35.1.0@forge-stage.sourceware.org/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/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.hhundg5lhq.gcc.gcc-TEST.peppe.35.1.0@forge-stage.sourceware.org>","list_archive_url":null,"date":"2026-04-22T17:45:33","name":"[v1,0/1] WIP: libstdc++: fix compile error when converting std::weak_ptr<T[]>","submitter":{"id":93222,"url":"http://patchwork.ozlabs.org/api/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.hhundg5lhq.gcc.gcc-TEST.peppe.35.1.0@forge-stage.sourceware.org/mbox/","series":[{"id":501055,"url":"http://patchwork.ozlabs.org/api/series/501055/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=501055","date":"2026-04-22T17:45:34","name":"WIP: libstdc++: fix compile error when converting std::weak_ptr<T[]>","version":1,"mbox":"http://patchwork.ozlabs.org/series/501055/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/covers/2226645/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 4g169T1KzZz1yHB\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 03:46:53 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 206BD4BB58A7\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 17:46:51 +0000 (GMT)","from forge-stage.sourceware.org (vm08.sourceware.org [38.145.34.39])\n by sourceware.org (Postfix) with ESMTPS id 9B58F4BAD159\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 17:46:24 +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 7704B42BE9\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 17:46:24 +0000 (UTC)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 206BD4BB58A7","OpenDKIM Filter v2.11.0 sourceware.org 9B58F4BAD159"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 9B58F4BAD159","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 9B58F4BAD159","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776879984; cv=none;\n b=xqG1gRLJNAzL/JMrlZNM6ME7p9B0fvC5RJILpkxIJH4l3AHpZFT7nG0yous+kfN/RLJvXaXF8GODs+3cCfTEUFq2F2VhbLL0aSjqMipEHbfAgwWUaFmlrF2sFq/5K0py5HU3AyCjqPoJD3lFEWmWiSKtWNCsYyoS6q2zHkKLiQg=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776879984; c=relaxed/simple;\n bh=17an9tu3IqIklnYjF67cG7JUw4R6v3gSofYpQb8rA1o=;\n h=From:Date:Subject:To:Message-ID;\n b=mW0Wne7HsVRSXD3rik+E7JtJpsNfx+mITa9pu/Dd6lRNg6t/bSKJsRtQ93f+2zLVESlzjKYEfVmZQ2OJuXfsMA6bJ59Pd5obDCBDwtCDfHJRJg1IRTXRR9A9B9toSHTVkGuNHhgyVQ7Au+fywH2ZthapUtS4Wb1xvzeAPnd8QiQ=","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 17:45:33 +0000","Subject":"[PATCH v1 0/1] WIP: libstdc++: fix compile error when converting\n std::weak_ptr<T[]>","To":"gcc-patches mailing list <gcc-patches@gcc.gnu.org>","Message-ID":"\n <bmm.hhundg5lhq.gcc.gcc-TEST.peppe.35.1.0@forge-stage.sourceware.org>","X-Mailer":"batrachomyomachia","X-Requested-Reviewer":"redi","X-Pull-Request-Organization":"gcc","X-Pull-Request-Repository":"gcc-TEST","X-Pull-Request":"https://forge.sourceware.org/gcc/gcc-TEST/pulls/35","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-06 10:06:37+00:00\nLatest update: 2025-08-13 03:36:59+00:00\nChanges: 0 changed files, 0 additions, 0 deletions\nHead revision: peppe/gcc-TEST ref refs/pull/35/head commit 5f1498adeac4466e9edf60fdc708d8fed0d6b7ab\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/35.diff\nDiscussion:  https://forge.sourceware.org/gcc/gcc-TEST/pulls/35\nRequested Reviewers: redi\n\nA std::weak_ptr<T[]> can be converted to a compatible\nstd::weak_ptr<U[]>. This is implemented by having suitable converting\nconstructors to std::weak_ptr which dispatch to the __weak_ptr base\nclass (implementation detail).\n\nIn __weak_ptr<T[]>, lock() is supposed to return a __shared_ptr<T[]>,\nnot a __shared_ptr<element_type> (that is, __shared_ptr<T>).\n\nUnfortunately the return type of lock() and the type of the returned\n__shared_ptr were mismatching and that was causing a compile error: when\nconverting a __weak_ptr<T[]> to a __weak_ptr<U[]> through __weak_ptr's\nconverting constructor, the code calls lock(), and that simply fails to\nbuild.\n\nFix it by removing the usage of element_type inside lock(), and using\n_Tp instead.\n\nNote that std::weak_ptr::lock() itself was already correct; the one in\n__weak_ptr was faulty (and that is the one called by __weak_ptr's\nconverting constructors).\n\n```\nlibstdc++-v3/ChangeLog:\n\n\t* include/bits/shared_ptr_base.h (lock): Fixed a compile error\n\twhen calling lock() on a weak_ptr<T[]>, by removing an\n\terroneous usage of element_type from within lock().\n\t* testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc:\n\tAdd more tests for array types.\n\t* testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc:\n\tLikewise.\n\t* testsuite/20_util/shared_ptr/requirements/1.cc: New test.\n\t* testsuite/20_util/weak_ptr/requirements/1.cc: New test.\n```\n\n\nChanged files:\n- A: libstdc++-v3/testsuite/20_util/shared_ptr/requirements/1.cc\n- A: libstdc++-v3/testsuite/20_util/weak_ptr/requirements/1.cc\n- M: libstdc++-v3/include/bits/shared_ptr_base.h\n- M: libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc\n- M: libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc\n\n\nGiuseppe D'Angelo (1):\n  libstdc++: fix compile error when converting std::weak_ptr<T[]>\n\n libstdc++-v3/include/bits/shared_ptr_base.h   |  2 +-\n .../20_util/shared_ptr/requirements/1.cc      | 33 +++++++++++++++++++\n .../requirements/explicit_instantiation/1.cc  | 12 +++++++\n .../20_util/weak_ptr/requirements/1.cc        | 33 +++++++++++++++++++\n .../requirements/explicit_instantiation/1.cc  | 12 +++++++\n 5 files changed, 91 insertions(+), 1 deletion(-)\n create mode 100644 libstdc++-v3/testsuite/20_util/shared_ptr/requirements/1.cc\n create mode 100644 libstdc++-v3/testsuite/20_util/weak_ptr/requirements/1.cc"}