-
-
Notifications
You must be signed in to change notification settings - Fork 264
non-mutable lambdas don't show members as const #189
Copy link
Copy link
Closed
Description
#include <iostream>
struct Data
{
int getData() const { return data; }
void setData(int d) { data = d; }
private:
int data {3};
};
int main()
{
Data d;
auto lambda = [=](int multiplier) /* mutable */-> int
{
//d.setData( d.getData() * multiplier ); //uncomment for errors
return d.getData();
};
auto result = lambda( 4 );
std::cout << "data's value: " << result << std::endl;
}
the generated lambda doesn't mark the private member in the anonymous body as const Data d;, which is should.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels