-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
[clang] name mangling for lambdas in local classes broken since clang-13 #88906
Comments
@llvm/issue-subscribers-clang-frontend Author: Daan Timmer (daantimmer)
Minimal Reproducible Example:
#include <iostream>
#include <functional>
int main(){
class Test{
public:
std::function<void()> a{[]{ std::cout << "a\n"; }};
std::function<void()> b{[]{ std::cout << "b\n"; }};
std::function<void()> c{[]{ std::cout << "c\n"; }};
};
Test test{};
test.a();
test.b();
test.c();
}
// output:
c
c
c
// expected:
a
b
c godbolt setup with clang-trunk, clang-12 and gcc-trunk: https://godbolt.org/z/EM36r4Ybo So, if you have a local class with lambda's the name mangling seems to be missing/going wrong. Resulting in only one actual lambda being declared. |
Here llvm-project/clang/lib/AST/ItaniumMangle.cpp Lines 2086 to 2102 in b632476
We seem to do the right thing for the 12ABI, but not for newer ABIs, which is odd. Itanium specification: https://itanium-cxx-abi.github.io/cxx-abi/abi.html#closure-types
|
We're supposed to call |
Lambdas used in the initializer of a local class were not mangling the name of the member. Fixes llvm#88906
Lambdas used in the initializer of a local class were not mangling the name of the member. Fixes #88906
Lambdas used in the initializer of a local class were not mangling the name of the member. Fixes llvm#88906
Minimal Reproducible Example:
godbolt setup with clang-trunk, clang-12 and gcc-trunk: https://godbolt.org/z/EM36r4Ybo
So, if you have a local class with lambda's the name mangling seems to be missing/going wrong. Resulting in only one actual lambda being declared.
The text was updated successfully, but these errors were encountered: