]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++/modules: Fix linkage checks for exported using-decls
authorNathaniel Shead <nathanieloshead@gmail.com>
Tue, 3 Sep 2024 15:18:19 +0000 (01:18 +1000)
committerNathaniel Shead <nathanieloshead@gmail.com>
Fri, 27 Sep 2024 03:49:23 +0000 (13:49 +1000)
commitd0762e93ce1ed046e1dd9477ebe0ad941c298677
tree4397cb7dafd5705ee82b30f6ded4c347394f3ace
parentad08ef098a8c8bb9c148d0a32e91456fdf58ffc1
c++/modules: Fix linkage checks for exported using-decls

This fixes some inconsistencies with what kinds of linkage various
entities are assumed to have.  This also fixes handling of exported
using-decls binding to GM entities and type aliases to better align with
the standard's requirements.

gcc/cp/ChangeLog:

* name-lookup.cc (check_can_export_using_decl): Handle internal
linkage GM entities (but ignore in header units); use linkage
of entity ultimately referred to by aliases.

gcc/testsuite/ChangeLog:

* g++.dg/modules/using-10.C: Add tests for no-linkage, fix
expected linkage of aliases.
* g++.dg/modules/using-12.C: Likewise.
* g++.dg/modules/using-27.C: New test.
* g++.dg/modules/using-28_a.C: New test.
* g++.dg/modules/using-28_b.C: New test.
* g++.dg/modules/using-29.H: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/name-lookup.cc
gcc/testsuite/g++.dg/modules/using-10.C
gcc/testsuite/g++.dg/modules/using-12.C
gcc/testsuite/g++.dg/modules/using-27.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/using-28_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/using-28_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/using-29.H [new file with mode: 0644]