Nathaniel Shead 66e9a4f308 c++/modules: Fix merge of TLS init functions [PR120363]
The PR notes that we missed setting DECL_CONTEXT on the TLS init
function; we missed this initially because this function is not created
in header units, only named modules.

I also noticed that 'DECL_CONTEXT (fn) = DECL_CONTEXT (var)' was
incorrect: for class members, this ends up having the modules merging
machinery treat the decl as a member function, which breaks when
attempting to dedup against an existing completed class type.  Instead
we can just use the global_namespace as the context, because the name of
the function is already mangled appropriately so that we'll match the
correct duplicates.

	PR c++/120363

gcc/cp/ChangeLog:

	* decl2.cc (get_tls_init_fn): Set context as global_namespace.
	(get_tls_wrapper_fn): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/pr113292_a.H: Move to...
	* g++.dg/modules/tls-1_a.H: ...here.
	* g++.dg/modules/pr113292_b.C: Move to...
	* g++.dg/modules/tls-1_b.C: ...here.
	* g++.dg/modules/pr113292_c.C: Move to...
	* g++.dg/modules/tls-1_c.C: ...here.
	* g++.dg/modules/tls-2_a.C: New test.
	* g++.dg/modules/tls-2_b.C: New test.
	* g++.dg/modules/tls-2_c.C: New test.
	* g++.dg/modules/tls-3.h: New test.
	* g++.dg/modules/tls-3_a.H: New test.
	* g++.dg/modules/tls-3_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
2025-05-24 08:54:33 +10:00
2025-01-02 11:59:57 +01:00
2025-05-23 15:26:10 -07:00
2025-04-02 00:18:25 +00:00
2025-05-15 00:19:47 +00:00
2025-01-02 11:59:57 +01:00
2025-05-23 00:17:35 +00:00
2025-04-11 00:17:32 +00:00
2025-01-02 11:59:57 +01:00
2025-05-17 00:17:29 +00:00
2025-01-02 11:59:57 +01:00
2024-10-26 00:19:39 +00:00
2025-05-22 00:19:06 +00:00
2025-05-21 00:17:57 +00:00
2025-05-14 00:18:21 +00:00
2025-04-25 00:18:00 +00:00
2025-04-01 00:19:09 +00:00
2025-05-14 00:18:21 +00:00
2025-05-10 00:17:59 +00:00
2025-01-02 11:59:57 +01:00
2025-05-10 00:17:59 +00:00
2025-04-10 00:18:06 +00:00
2025-05-03 00:18:18 +00:00
2025-01-02 11:59:57 +01:00
2025-05-10 00:17:59 +00:00
2025-03-07 00:17:19 +00:00
2025-05-22 00:19:06 +00:00
2024-11-19 12:27:33 +01:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 4.2 GiB
Languages
C++ 30.8%
C 30.2%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.3%