From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7BD0838582B0; Sun, 4 Sep 2022 17:14:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BD0838582B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662311661; bh=tPqF25PJrAWp+87CNHuDW8/uG3me7DLKX1ZXQ6xq1M4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=L6VBsuxKqDsaHV+Ecp1pLbln27MjCukvHmZVlFePvCJg7+wYUCLGrtMW6LyJC3VYS o5PaFrgzhAluFTCzmd9VzPbu2pStU0XUbyy15I+UkLI7rJMK+i+SBR2SqFnLTEc8Xq Unc/cJ8ygnqzcaG5he7dE53u8em133zhq6EvEr58= From: "markmigm at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106825] header unit based std::shared_ptr<...>(...) use gets: undefined reference to `std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release()', aarch64 example Date: Sun, 04 Sep 2022 17:14:21 +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: 12.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: markmigm at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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=3D106825 --- Comment #2 from Mark Millard --- An tiny example that avoids all involvement of libstdc++ is (showing g++12 from FreeBSD in the comments, instead of c++ for fedora --but both contexts fail): # more module_template_specialization_failure.cppm // g++12 -std=3Dc++20 -pedantic -Wall -Wextra -fmodules-ts -xc++-system-hea= der memory // g++12 -std=3Dc++20 -fmodules-ts -g -fPIC -xc++ -c module_template_specialization_failure.cppm export module module_template_specialization_intf; export template int test(); export template<> int test<0>() { return -1; }; export template<> int test<1>() { return -2; }; # more module_template_specialization_failure.cpp // g++12 -std=3Dc++20 -pedantic -Wall -Wextra -fmodules-ts -xc++-system-hea= der memory // g++12 -std=3Dc++20 -pedantic -Wall -Wextra -fmodules-ts -fPIC -c=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 -xc++ module_template_specialization_failure.cppm // g++12 -std=3Dc++20 -pedantic -Wall -Wextra -fmodules-ts -fPIC -omain_using_plugin module_template_specialization_failure.cpp import module_template_specialization_intf; int main() { return test<0>()-test<1>(); } The sequence and result is: # c++ -std=3Dc++20 -pedantic -Wall -Wextra -fmodules-ts -xc++-system-header memory # c++ -std=3Dc++20 -pedantic -Wall -Wextra -fmodules-ts -fPIC -c -xc++ module_template_specialization_failure.cppm # c++ -std=3Dc++20 -pedantic -Wall -Wextra -fmodules-ts -fPIC -omain_using_= plugin module_template_specialization_failure.cpp /usr/bin/ld: /tmp/ccmyKNjk.o: in function `main': module_template_specialization_failure.cpp:(.text+0xc): undefined reference= to `_ZW35module_template_specialization_intf4testILi0EEiv' /usr/bin/ld: module_template_specialization_failure.cpp:(.text+0x14): undef= ined reference to `_ZW35module_template_specialization_intf4testILi1EEiv' /usr/bin/ld: /tmp/ccmyKNjk.o: in function `_GLOBAL__sub_I_module_template_specialization_failure.cpp': module_template_specialization_failure.cpp:(.text+0x30): undefined referenc= e to `_ZGIW35module_template_specialization_intf' collect2: error: ld returned 1 exit status=