From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4AA21385EC09; Mon, 6 May 2024 11:51:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4AA21385EC09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714996282; bh=Aruhc9fPm2av/RO9Uoqp4Irq/xZWFOV1Dh8hcmoHPvQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hAGa50C4M9EhJe+gEbWKO8siofv7+XPXK9FMPBAF5ZzDnCbRMIfmfzdG7qXl743uX +J9kdHVQgg8ZVG60UFB2g88O8YVrBoKWRebdzeKoD3/zu0RqA/Eabm8bKuNYtZJsW7 ISf674Albqum6dh33YRVB8A/BmuJ06BWFCcn7Xfo= From: "adhemerval.zanella at linaro dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114275] using std::thread within a templated function in a module fails to compile Date: Mon, 06 May 2024 11:51:20 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: adhemerval.zanella at linaro dot org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: nshead at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114275 Adhemerval Zanella changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |adhemerval.zanella at lina= ro dot o | |rg --- Comment #8 from Adhemerval Zanella --- (In reply to GCC Commits from comment #6) > The master branch has been updated by Nathaniel Shead : >=20 > https://gcc.gnu.org/g:b5f6a56940e70838a07e885de03a92e2bd64674a >=20 > commit r15-59-gb5f6a56940e70838a07e885de03a92e2bd64674a > Author: Nathaniel Shead > Date: Mon Apr 29 17:00:13 2024 +1000 >=20 > c++: Fix instantiation of imported temploid friends [PR114275] >=20=20=20=20=20 > This patch fixes a number of issues with the handling of temploid fri= end > declarations. >=20=20=20=20=20 > The primary issue is that instantiations of friend declarations should > attach the declaration to the same module as the befriending class, by > [module.unit] p7.1 and [temp.friend] p2; this could be a different > module from the current TU, and so needs special handling. >=20=20=20=20=20 > The other main issue here is that we can't assume that just because n= ame > lookup didn't find a definition for a hidden class template, that it > doesn't exist at all: it could be a non-exported entity that we've > nevertheless streamed in from an imported module. We need to ensure > that when instantiating template friend classes that we return the sa= me > TEMPLATE_DECL that we got from our imports, otherwise we will get lat= er > issues with 'duplicate_decls' (rightfully) complaining that they're > different when trying to merge. >=20=20=20=20=20 > This doesn't appear necessary for function templates due to the exist= ing > name lookup handling already finding these hidden declarations. >=20=20=20=20=20 > PR c++/105320 > PR c++/114275 >=20=20=20=20=20 > gcc/cp/ChangeLog: >=20=20=20=20=20 > * cp-tree.h (propagate_defining_module): Declare. > (lookup_imported_hidden_friend): Declare. > * decl.cc (duplicate_decls): Also check if hidden decls can be > redeclared in this module. > * module.cc (imported_temploid_friends): New. > (init_modules): Initialize it. > (trees_out::decl_value): Write it; don't consider imported > temploid friends as attached to a module. > (trees_in::decl_value): Read it. > (get_originating_module_decl): Follow the owning decl for an > imported temploid friend. > (propagate_defining_module): New. > * name-lookup.cc (get_mergeable_namespace_binding): New. > (lookup_imported_hidden_friend): New. > * pt.cc (tsubst_friend_function): Propagate defining module f= or > new friend functions. > (tsubst_friend_class): Lookup imported hidden friends. Check > for valid module attachment of existing names. Propagate > defining module for new classes. >=20=20=20=20=20 > gcc/testsuite/ChangeLog: >=20=20=20=20=20 > * g++.dg/modules/tpl-friend-10_a.C: New test. > * g++.dg/modules/tpl-friend-10_b.C: New test. > * g++.dg/modules/tpl-friend-10_c.C: New test. > * g++.dg/modules/tpl-friend-10_d.C: New test. > * g++.dg/modules/tpl-friend-11_a.C: New test. > * g++.dg/modules/tpl-friend-11_b.C: New test. > * g++.dg/modules/tpl-friend-12_a.C: New test. > * g++.dg/modules/tpl-friend-12_b.C: New test. > * g++.dg/modules/tpl-friend-12_c.C: New test. > * g++.dg/modules/tpl-friend-12_d.C: New test. > * g++.dg/modules/tpl-friend-12_e.C: New test. > * g++.dg/modules/tpl-friend-12_f.C: New test. > * g++.dg/modules/tpl-friend-13_a.C: New test. > * g++.dg/modules/tpl-friend-13_b.C: New test. > * g++.dg/modules/tpl-friend-13_c.C: New test. > * g++.dg/modules/tpl-friend-13_d.C: New test. > * g++.dg/modules/tpl-friend-13_e.C: New test. > * g++.dg/modules/tpl-friend-13_f.C: New test. > * g++.dg/modules/tpl-friend-13_g.C: New test. > * g++.dg/modules/tpl-friend-14_a.C: New test. > * g++.dg/modules/tpl-friend-14_b.C: New test. > * g++.dg/modules/tpl-friend-14_c.C: New test. > * g++.dg/modules/tpl-friend-14_d.C: New test. > * g++.dg/modules/tpl-friend-9.C: New test. >=20=20=20=20=20 > Signed-off-by: Nathaniel Shead > Reviewed-by: Jason Merrill This has triggered some regression on aarch64 [1]: Running g++:g++.dg/modules/modules.exp ... FAIL: g++.dg/modules/tpl-friend-4_b.C -std=3Dc++17 (test for errors, line = 16) FAIL: g++.dg/modules/tpl-friend-4_b.C -std=3Dc++17 (test for errors, line = 19) FAIL: g++.dg/modules/tpl-friend-4_b.C -std=3Dc++17 (internal compiler error= : in set_originating_module, at cp/module.cc:19236) FAIL: g++.dg/modules/tpl-friend-4_b.C -std=3Dc++17 (test for excess errors) https://ci.linaro.org/job/tcwg_gnu_native_check_gcc--master-aarch64-build/1= 092/artifact/artifacts/notify/mail-body.txt/*view*/=