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
intmain()
{
constexprint a{};
[]{return a;}();//compile yes
[]{a;}();//compile no
}
Diagnostic:
<source>:5:8: error: variable 'a' cannot be implicitly captured in a lambda with no capture-default specified 5 | []{a;}();//compile no | ^<source>:3:19: note: 'a' declared here 3 | constexpr int a{}; | ^<source>:5:5: note: lambda expression begins here 5 | []{a;}();//compile no | ^<source>:5:6: note: capture 'a' by value 5 | []{a;}();//compile no | ^ | a<source>:5:6: note: capture 'a' by reference 5 | []{a;}();//compile no | ^ | &a<source>:5:6: note: default capture by value 5 | []{a;}();//compile no | ^ | =<source>:5:6: note: default capture by reference 5 | []{a;}();//compile no | ^ | &<source>:5:8: warning: expression result unused [-Wunused-value] 5 | []{a;}();//compile no | ^1 warning and 1 error generated.Compiler returned: 1
The text was updated successfully, but these errors were encountered:
Diagnostic:
The text was updated successfully, but these errors were encountered: