-
-
Notifications
You must be signed in to change notification settings - Fork 262
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
According to http://eel.is/c++draft/expr.prim.lambda#capture-10 and cppreference.org lambdas seems to capture references as copies of the decayed type.
But cppinsights does not agree given:
#include <string>
void func(const std::string& arg) {
[arg] {
return arg.size();
};
}
int main() {
std::string b;
func(b);
}
It generates:
const std::basic_string<char, std::char_traits<char>, std::allocator<char> > & arg;
public: __lambda_5_3(const std::basic_string<char, std::char_traits<char>, std::allocator<char> > & _arg)
: arg{_arg}
{}
Where i would expect based on the linked section that it would produce:
const std::basic_string<char, std::char_traits<char>, std::allocator<char> > arg;
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working