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

* [Bug c++/106567] [13 regression] 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 [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 ` ville.voutilainen at gmail dot com
  2022-08-08 21:02 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ville.voutilainen at gmail dot com @ 2022-08-08 20:49 UTC (permalink / raw)
  To: gcc-bugs

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>();
}

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

* [Bug c++/106567] [13 regression] 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 [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
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-08 21:02 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
   Target Milestone|---                         |13.0

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

* [Bug c++/106567] [13 regression] 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 [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
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-08 21:03 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
           Keywords|                            |needs-bisection
   Last reconfirmed|                            |2022-08-08

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/106567] [13 regression] 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 [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
                   ` (2 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-08-08 21:07 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r13-53-g53e7252140c95a.

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

* [Bug c++/106567] [13 Regression] 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 [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
                   ` (3 preceding siblings ...)
  2022-08-08 21:07 ` mpolacek at gcc dot gnu.org
@ 2022-08-08 21:08 ` mpolacek at gcc dot gnu.org
  2022-08-09  8:13 ` m.cencora at gmail dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-08-08 21:08 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
            Summary|[13 regression] An array    |[13 Regression] An array
                   |with a dependent type and   |with a dependent type and
                   |initializer-deduced bound   |initializer-deduced bound
                   |is treated as an array of   |is treated as an array of
                   |unknown bound when captured |unknown bound when captured
                   |in a lambda                 |in a lambda

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

* [Bug c++/106567] [13 Regression] 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 [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
                   ` (4 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: m.cencora at gmail dot com @ 2022-08-09  8:13 UTC (permalink / raw)
  To: gcc-bugs

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

m.cencora at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |m.cencora at gmail dot com

--- Comment #4 from m.cencora at gmail dot com ---
Seems related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93259

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

* [Bug c++/106567] [13 Regression] 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 [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
                   ` (5 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2022-09-12 16:55 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
                 CC|                            |jason at gcc dot gnu.org

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

* [Bug c++/106567] [13 Regression] 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 [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
                   ` (6 preceding siblings ...)
  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
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-12 17:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:7c989a8ed47228bdd494a2f0d1f6fdd325f953d7

commit r13-2628-g7c989a8ed47228bdd494a2f0d1f6fdd325f953d7
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Sep 12 12:59:46 2022 -0400

    c++: lambda capture of array with deduced bounds [PR106567]

    We can't use the type of an array variable directly if we haven't deduced
    its length yet.

            PR c++/106567

    gcc/cp/ChangeLog:

            * lambda.cc (type_deducible_expression_p): Check
            array_of_unknown_bound_p.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/lambda/lambda-array4.C: New test.

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

* [Bug c++/106567] [13 Regression] 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 [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
                   ` (7 preceding siblings ...)
  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
  9 siblings, 0 replies; 11+ messages in thread
From: ville.voutilainen at gmail dot com @ 2022-09-13 20:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Since this is a 13 regression, we can close this, right? There's no backports
needed.

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

* [Bug c++/106567] [13 Regression] 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 [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
                   ` (8 preceding siblings ...)
  2022-09-13 20:29 ` ville.voutilainen at gmail dot com
@ 2022-09-15 10:14 ` jason at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2022-09-15 10:14 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.

^ 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).