public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.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 [thread overview] Message-ID: <bug-109887-4-IhKU9N8a2F@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-109887-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109887 --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, simpler testcase would be #include <type_traits> template <class T> std::enable_if_t <std::is_integral <T>::value, int> foo() { return 0; } int a = foo<int> (); 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<std::is_integral<int>::value, int>::type foo<int>() 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 <unresolved-name> ::= [gs] <base-unresolved-name> # x or (with "gs") ::x ::= sr <unresolved-type> <base-unresolved-name> # T::x / decltype(p)::x ... and <unresolved-type> ::= <template-param> [ <template-args> ] # T:: or T<X,Y>:: ::= <decltype> # decltype(p):: ::= <substitution> and <substitution> ::= St # ::std:: among other things, so I think st is what should be used instead of 3std.
next prev parent reply other threads:[~2023-05-17 10:19 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-17 9:00 [Bug c++/109887] New: " yedeng.yd at linux dot alibaba.com 2023-05-17 10:13 ` [Bug c++/109887] " redi at gcc dot gnu.org 2023-05-17 10:15 ` redi at gcc dot gnu.org 2023-05-17 10:19 ` jakub at gcc dot gnu.org [this message] 2023-10-05 22:32 ` jason at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-109887-4-IhKU9N8a2F@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).