]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: modules, clones, and overload resolution
authorJason Merrill <jason@redhat.com>
Mon, 3 Nov 2025 14:51:38 +0000 (17:51 +0300)
committerJason Merrill <jason@redhat.com>
Mon, 3 Nov 2025 14:51:38 +0000 (17:51 +0300)
commit9f428ffbd4b6de9c940f1a1a304973bcd2f2bd4e
treefbc9300b1eae32d205231e2040b3c74526252297
parentca554581288fc27559df8150c1a5a915b915bc2b
c++: modules, clones, and overload resolution

21_strings/basic_string_view/cons/wchar_t/3.cc was failing with import std
because as in the reduced testcase, the module includes an instantiation of
the template constructor for <const char *, const char *>, and importing the
module was wrongly adding that instantiation to CLASSTYPE_MEMBER_VEC, so it
became part of the overload set independent of its template.
tsubst_function_decl doesn't add to CLASSTYPE_MEMBER_VEC, and importing
should work the same.

gcc/cp/ChangeLog:

* module.cc (trees_in::decl_value): Don't add an instantiation to
CLASSTYPE_MEMBER_VEC.

gcc/testsuite/ChangeLog:

* g++.dg/modules/clone-5_a.C: New test.
* g++.dg/modules/clone-5_b.C: New test.
gcc/cp/module.cc
gcc/testsuite/g++.dg/modules/clone-5_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/clone-5_b.C [new file with mode: 0644]