-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Merged definitions of member functions distinguished by non-functionally-equivalent constraints and by deduced return type #61273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
ABI
Application Binary Interface
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
Comments
@llvm/issue-subscribers-clang-frontend |
CC @erichkeane |
Definitely looks like it. We don't have guidance from the Itanium ABI folks yet as far as I know (and this would be something for one of the codegen code owners to take a look at: @rjmccall @efriedma-quic @asl). |
zygoloid
added a commit
that referenced
this issue
Sep 20, 2023
This implements proposals from: - itanium-cxx-abi/cxx-abi#24: mangling for constraints, requires-clauses, requires-expressions. - itanium-cxx-abi/cxx-abi#31: requires-clauses and template parameters in a lambda expression are mangled into the <lambda-sig>. - itanium-cxx-abi/cxx-abi#47 (STEP 3): mangling for template argument is prefixed by mangling of template parameter declaration if it's not "obvious", for example because the template parameter is constrained (we already implemented STEP 1 and STEP 2). This changes the manglings for a few cases: - Functions and function templates with constraints. - Function templates with template parameters with deduced types: `typename<auto N> void f();` - Function templates with template template parameters where the argument has a different template-head: `template<template<typename...T>> void f(); f<std::vector>();` In each case where a mangling changed, the change fixes a mangling collision. Note that only function templates are affected, not class templates or variable templates, and only new constructs (template parameters with deduced types, constrained templates) and esoteric constructs (templates with template template parameters with non-matching template template arguments, most of which Clang still does not accept by default due to `-frelaxed-template-template-args` not being enabled by default), so the risk to ABI stability from this change is relatively low. Nonetheless, `-fclang-abi-compat=17` can be used to restore the old manglings for cases which we could successfully but incorrectly mangle before. Fixes #48216, #49884, #61273 Reviewed By: erichkeane, #libc_abi Differential Revision: https://reviews.llvm.org/D147655
Fixed in 4b163e3. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
ABI
Application Binary Interface
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
The above program is accepted and returns 4; the expected result would be 3. Inspection of the code (by O0 or by volatile) determines that a single
A<int>::f()
is emitted, corresponding to #.2.Very strangely, replacing
2u
by2l
andunsigned
bylong
causes clang to reject: "definition with same mangled name '_ZN1AIiE1fEv' as another definition". This seems more sensible, but is apparently contra the Standard says: cplusplus/CWG#256. I have pointed out that following the Standard would require mangling constraints, which I view as a non starter since it would break ABI now and in future.The text was updated successfully, but these errors were encountered: