You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have no idea why the standard is this way....but it is.
Hence in cppinsights I would expect to see something like __lambda_xyz& operator=(__lambda_xyz const &) = delete; for lambdas that capture.
First let's be sure we are on the same page. You referring to something like this (in C++ Insights)
:
intmain()
{
int a = 4;
auto lamb = [a]{};
decltype(lamb) lambCopy = lamb;
// lamb = lambCopy;
}
The reason why you don't see the expected deleted assignment operator is simply because it is not there. Clang doesn't border creating implicit special members if they are not used. You can see this in the AST output at Godbolt. Once you start assigning the lambCopy to lamb, the assignment operator is used but then deleted, making the program ill-formed. As a result, you don't see any output in C++ Insights.
I have no idea why the standard is this way....but it is.
Hence in cppinsights I would expect to see something like
__lambda_xyz& operator=(__lambda_xyz const &) = delete;
for lambdas that capture.http://eel.is/c++draft/expr.prim.lambda#closure-13
The text was updated successfully, but these errors were encountered: