-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 conceptslambdaC++11 lambda expressionsC++11 lambda expressions
Description
https://godbolt.org/z/sKEaYxMWs
#include <array>
struct Test
{
template<auto...>
friend constexpr bool asdf()noexcept
requires([]
{
std::array<bool, 123> visited{};
for (const bool x : visited)//error: variable '__begin2' cannot be implicitly captured in a lambda with no capture-default specified
if (x)
return false;
return true;
}())
{
return {};
}
};
<source>:9:27: error: variable '__begin3' cannot be implicitly captured in a lambda with no capture-default specified
9 | for (const bool x : visited)//error: variable '__begin2' cannot be implicitly captured in a lambda with no capture-default specified
| ^
<source>:7:5: note: while substituting into a lambda expression here
7 | {
| ^
<source>:9:27: note: '__begin3' declared here
9 | for (const bool x : visited)//error: variable '__begin2' cannot be implicitly captured in a lambda with no capture-default specified
| ^
<source>:6:14: note: lambda expression begins here
6 | requires([]
| ^
<source>:6:15: note: capture '__begin3' by value
6 | requires([]
| ^
| __begin3
<source>:6:15: note: capture '__begin3' by reference
6 | requires([]
| ^
| &__begin3
<source>:6:15: note: default capture by value
6 | requires([]
| ^
| =
<source>:6:15: note: default capture by reference
6 | requires([]
| ^
| &
<source>:9:27: error: variable '__end3' cannot be implicitly captured in a lambda with no capture-default specified
9 | for (const bool x : visited)//error: variable '__begin2' cannot be implicitly captured in a lambda with no capture-default specified
| ^
<source>:9:27: note: '__end3' declared here
<source>:6:14: note: lambda expression begins here
6 | requires([]
| ^
<source>:6:15: note: capture '__end3' by value
6 | requires([]
| ^
| __end3
<source>:6:15: note: capture '__end3' by reference
6 | requires([]
| ^
| &__end3
<source>:6:15: note: default capture by value
6 | requires([]
| ^
| =
<source>:6:15: note: default capture by reference
6 | requires([]
| ^
| &
<source>:9:27: error: variable '__begin3' cannot be implicitly captured in a lambda with no capture-default specified
9 | for (const bool x : visited)//error: variable '__begin2' cannot be implicitly captured in a lambda with no capture-default specified
| ^
<source>:9:27: note: '__begin3' declared here
<source>:6:14: note: lambda expression begins here
6 | requires([]
| ^
<source>:6:15: note: capture '__begin3' by value
6 | requires([]
| ^
| __begin3
<source>:6:15: note: capture '__begin3' by reference
6 | requires([]
| ^
| &__begin3
<source>:6:15: note: default capture by value
6 | requires([]
| ^
| =
<source>:6:15: note: default capture by reference
6 | requires([]
| ^
| &
<source>:10:17: error: variable 'x' cannot be implicitly captured in a lambda with no capture-default specified
10 | if (x)
| ^
<source>:9:25: note: 'x' declared here
9 | for (const bool x : visited)//error: variable '__begin2' cannot be implicitly captured in a lambda with no capture-default specified
| ^
<source>:6:14: note: lambda expression begins here
6 | requires([]
| ^
<source>:6:15: note: capture 'x' by value
6 | requires([]
| ^
| x
<source>:6:15: note: capture 'x' by reference
6 | requires([]
| ^
| &x
<source>:6:15: note: default capture by value
6 | requires([]
| ^
| =
<source>:6:15: note: default capture by reference
6 | requires([]
| ^
| &
4 errors generated.
Compiler returned: 1
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 conceptslambdaC++11 lambda expressionsC++11 lambda expressions