From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2C6183858CDA; Fri, 17 Mar 2023 23:02:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C6183858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679094130; bh=Uy3j/b1anjXU4j2lSV4Lf5VXKWqXb9s80vc+jYS3EKg=; h=From:To:Subject:Date:From; b=PRuudeVVucXQBTFvOKn9xiLqXu17h4GD/lnUav4G+XdhzY+6qlFNxLpXqPZXp0sPU 40wn8MfK5Q1MHBdly1ViRUVTf0uPkCnOkYvxe1cl/fbZN5o9nPqhrAKHI1xDglwh3S NRBp3f6jjDmszwHTG1tT3Zs3hFJ225QbkSXGCZw4= From: "idhameed at protonmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109180] New: Explicit template instantiation doesn't work for constexpr destructors on arm32 when optimizations are enabled Date: Fri, 17 Mar 2023 23:02:09 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: idhameed at protonmail 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D109180 Bug ID: 109180 Summary: Explicit template instantiation doesn't work for constexpr destructors on arm32 when optimizations are enabled Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: idhameed at protonmail dot com Target Milestone: --- Example (compile with "g++ -std=3Dc++20 -O -c"): =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D template struct record { constexpr ~record() { } }; inline record return_record() { return {}; } template record::~record(); =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Compiler Explorer: https://godbolt.org/z/j37rvr961 GCC 10+ targeting 32-bit ARM won't emit any symbols for record::~reco= rd when using most -O levels (-O, -O2, -O3, -Ofast, -Og). Using -fno-inline--or placing the explicit instantiation of record::~record above the definition of return_record--works around this bug and causes a symbol for record::~record to be emitted, as I'd expect. x86-64 GCC doesn't have this problem. The original, non-minimized problem I encountered: GCC 12.2.0 as a cross-compiler on an x86-64 host targeting arm-linux-gnueabihf can't be use= d to compile and link LLVM 15's libc++, because libc++'s implementation of std::basic_string has code that fits the aformentioned pattern--there's an overload of `std::__1::literals::string_literals::operator "" s` that retur= ns a basic_string. I tried the release/15.x branch of llvm-project at comm= it 92e7ef99303f8f367f279ccfa2393e4b96db915a.=