-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partylambdaC++11 lambda expressionsC++11 lambda expressions
Description
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
cgodbolt 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.
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partylambdaC++11 lambda expressionsC++11 lambda expressions