From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A97273858D37; Tue, 23 May 2023 13:35:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A97273858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684848913; bh=AirA9w33erOyJF3ZsPIqZ+zUOjrVO/NpfR8/psEk9PE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MLt2PhJxL/R+mCDLdQohsAtzBCHplryG20Ef5U+TNkl+GYaEl89+cGhKJ46vjxSMg p72cJbMQzuDeTZZpxq3E1pWD3qTPnm4ypOWyl646U7qVWg/oPL4VF5w+BG137OWyci Ff+Vw9JDU+OSxpylzJ+YYbZ/6KGWxDo98QN0t7OU= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109942] Function template declared extern is implicitly instantiated on -O optimization level when return type is auto Date: Tue, 23 May 2023 13:35:13 +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.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org 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=3D109942 --- Comment #2 from Jonathan Wakely --- You can add [[gnu::noinline]] to the function template if you really want to prevent it from being inlined, but it won't prevent it being instantiated.=