public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [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
@ 2022-08-08 20:36 ville.voutilainen at gmail dot com
  2022-08-08 20:49 ` [Bug c++/106567] [13 regression] " ville.voutilainen at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: ville.voutilainen at gmail dot com @ 2022-08-08 20:36 UTC (permalink / raw)
  To: gcc-bugs

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) {}
      |         ^~~

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-09-15 10:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-08 20:36 [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
2022-08-08 20:49 ` [Bug c++/106567] [13 regression] " ville.voutilainen at gmail dot com
2022-08-08 21:02 ` pinskia at gcc dot gnu.org
2022-08-08 21:03 ` pinskia at gcc dot gnu.org
2022-08-08 21:07 ` mpolacek at gcc dot gnu.org
2022-08-08 21:08 ` [Bug c++/106567] [13 Regression] " mpolacek at gcc dot gnu.org
2022-08-09  8:13 ` m.cencora at gmail dot com
2022-09-12 16:55 ` jason at gcc dot gnu.org
2022-09-12 17:50 ` cvs-commit at gcc dot gnu.org
2022-09-13 20:29 ` ville.voutilainen at gmail dot com
2022-09-15 10:14 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).