[Bug c++/106567] New: An array with a dependent type and initializer-deduced bound is treated as an array of unknown bound when captured in a lambda
ville.voutilainen at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Aug 8 20:36:10 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106567
Bug ID: 106567
Summary: An array with a dependent type and initializer-deduced
bound is treated as an array of unknown bound when
captured in a lambda
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ville.voutilainen at gmail dot com
Target Milestone: ---
Test:
#include <vector>
template <class T>
void urgh()
{
using V = typename T::value_type;
const V x[] = {V(0), V(1), V(2), V(0)};
[&]() {
for (auto& v : x) {}
}();
}
void no_urgh()
{
using V = int;
const V x[] = {V(0), V(1), V(2), V(0)};
[&]() {
for (auto& v : x) {}
}();
}
int main()
{
no_urgh();
urgh<std::vector<int>>();
}
Live demo at https://wandbox.org/permlink/9hSQdxhNzgDCuXYZ
prog.cc: In instantiation of 'void urgh() [with T = std::vector<int>]':
prog.cc:29:27: required from here
prog.cc:11:9: error: range-based 'for' expression of type 'const int []' has
incomplete type
11 | for (auto& v : x) {}
| ^~~
More information about the Gcc-bugs
mailing list