From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9154E3858D39; Wed, 17 May 2023 10:19:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9154E3858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684318781; bh=zQ7waCkCxUJHQO2wbK69mJE7Rsj0uT/FUnSi8JOwZ8U=; h=From:To:Subject:Date:In-Reply-To:References:From; b=au7jS6woxDgf21/s+GEK+a0HnRcLMBW75D0rgJItBDwC8Q5yFLHHFD20ZlZJnRQHD evq1bV+arxMFrqgrOA3WYR5SDmX85970462xLHW1f5mU10E5hjaCpHfZDnoUfI2jaV 8IgKrTQvQC4ziSvUzCyBnu4TMyQd25fjwKo465Fo= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109887] Different mangled name for template specialization for clang and gcc Date: Wed, 17 May 2023 10:19:41 +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.3.1 X-Bugzilla-Keywords: ABI X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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=3D109887 --- Comment #3 from Jakub Jelinek --- So, simpler testcase would be #include template std::enable_if_t ::value, int> foo() { return 0; } int a =3D foo (); GCC mangles this as _Z3fooIiENSt9enable_ifIXsrSt11is_integralIT_E5valueEiE4typeEv while clang as _Z3fooIiENSt9enable_ifIXsr3std11is_integralIT_EE5valueEiE4typeEv but c++filt is able to demangle both as std::enable_if::value, int>::type foo() So, the difference between the two is that gcc uses substitution St for std= :: while clang doesn't. In https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling sr is ::=3D [gs] # x= or (with "gs") ::x ::=3D sr #= T::x / decltype(p)::x ... and ::=3D [ ] # T= :: or T:: ::=3D # decltype(p):: ::=3D and ::=3D St # ::std:: among other things, so I think st is what should be used instead of 3std.=