From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2489D3858CDB; Wed, 29 May 2024 21:36:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2489D3858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1717018619; bh=TOYpQX1Thd49W0ioCgVaYgoGd0+qgK1cJCSWZ9SS5HM=; h=From:To:Subject:Date:From; b=ph0+ZcA1J8TmmhCC1gF+JOGdQea1rstLN9Da/A5ZxgMOWEvRFvFoErAAc7RTUTdve ms4rbbdQtVzmNOXMRwIDNED6zIFiVJW5MK2dCXZCiexWQpNNanT7QGjCiP+AiUcOoX hUo0CE2piFuOseuZM6ira3P/T2hHLPR4iHbVYsIM= From: "gcc at hazardy dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/115283] New: [14 Regression] "used but never defined" with extern templates Date: Wed, 29 May 2024 21:36:58 +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: 14.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gcc at hazardy dot de 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=3D115283 Bug ID: 115283 Summary: [14 Regression] "used but never defined" with extern templates Product: gcc Version: 14.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc at hazardy dot de Target Milestone: --- This reduced code does work with GCC 13, but with 14 I get the "used but ne= ver defined" warning (and later undefined refernces, even tho the symbols are emitted to the object files). See https://godbolt.org/z/Gsz4x7d6h #include #include template class C { public: using ResultT =3D std::conditional_t, T, T>; ResultT Result; C(ResultT result); }; template C::C(ResultT result) : Result{result} { return; } extern template class C; void foo() { C r(true); } It is absolutely necessary to use the std::same_as for the conditional. If = it is replaced with true (or false) everything works. Even exchanging it with sizeof(T) >=3D 2 works. std::is_same_v also works. So maybe it's a bug in std::same_as?=