https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106567

--- Comment #1 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Repro without std::vector:

template <class V>
void urgh()
{
    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<int>();
}

Reply via email to