Open
Description
The original code from #57958 still fails.
See https://godbolt.org/z/MbYYYKfv1.
#include <type_traits>
template<auto F> concept constant_invocable = requires { typename std::integral_constant<int, (F(), 0)>; };
template<class T>
constexpr bool C =
[](auto) {
return not constant_invocable<[]() {
T v;
(void)T{v};
}>;
}(0);
static_assert(C<int>);
<source>:10:15: warning: variable 'v' is uninitialized when used here [-Wuninitialized]
(void)T{v};
^
<source>:14:15: note: in instantiation of variable template specialization 'C<int>' requested here
static_assert(C<int>);
^
<source>:9:10: note: initialize the variable 'v' to silence this warning
T v;
^
= 0
<source>:10:15: error: variable 'v' cannot be implicitly captured in a lambda with no capture-default specified
(void)T{v};
^
<source>:7:3: note: in instantiation of function template specialization '(anonymous class)::operator()<int>' requested here
[](auto) {
^
<source>:14:15: note: in instantiation of variable template specialization 'C<int>' requested here
static_assert(C<int>);
^
<source>:9:9: note: 'v' declared here
T v;
^
<source>:8:35: note: lambda expression begins here
return not constant_invocable<[]() {
^
<source>:8:36: note: capture 'v' by value
return not constant_invocable<[]() {
^
v
<source>:8:36: note: capture 'v' by reference
return not constant_invocable<[]() {
^
&v
<source>:8:36: note: default capture by value
return not constant_invocable<[]() {
^
=
<source>:8:36: note: default capture by reference
return not constant_invocable<[]() {
^
&
1 warning and 1 error generated.
Compiler returned: 1