public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/85889] lambda expression can capture structured bindings
       [not found] <bug-85889-4@http.gcc.gnu.org/bugzilla/>
@ 2022-11-02  0:21 ` ville.voutilainen at gmail dot com
  2022-11-02  0:30 ` ville.voutilainen at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: ville.voutilainen at gmail dot com @ 2022-11-02  0:21 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |ASSIGNED

--- Comment #4 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Clang and MSVC now accept the code in their C++20 modes. Close as invalid? Or
does someone want to fix this for the C++17 and below modes only?

I don't suppose we ever decided in the committee to make this a DR.

[expr.prim.lambda.capture]/4 says:
"The identifier in a simple-capture shall denote a local entity (6.5.3, 6.1)."
6.1 specifies structured bindings to be local entities, so capturing them is
now supported.

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

* [Bug c++/85889] lambda expression can capture structured bindings
       [not found] <bug-85889-4@http.gcc.gnu.org/bugzilla/>
  2022-11-02  0:21 ` [Bug c++/85889] lambda expression can capture structured bindings ville.voutilainen at gmail dot com
@ 2022-11-02  0:30 ` ville.voutilainen at gmail dot com
  2024-05-09 17:03 ` cvs-commit at gcc dot gnu.org
  2024-05-09 17:05 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: ville.voutilainen at gmail dot com @ 2022-11-02  0:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
And the papers that changed this are
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1091r3.html and
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1381r1.html

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

* [Bug c++/85889] lambda expression can capture structured bindings
       [not found] <bug-85889-4@http.gcc.gnu.org/bugzilla/>
  2022-11-02  0:21 ` [Bug c++/85889] lambda expression can capture structured bindings ville.voutilainen at gmail dot com
  2022-11-02  0:30 ` ville.voutilainen at gmail dot com
@ 2024-05-09 17:03 ` cvs-commit at gcc dot gnu.org
  2024-05-09 17:05 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-09 17:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:46bafd9a6b9b776142e0b1424a6ac02e3a2fd300

commit r15-348-g46bafd9a6b9b776142e0b1424a6ac02e3a2fd300
Author: Marek Polacek <polacek@redhat.com>
Date:   Fri Mar 1 17:13:02 2024 -0500

    c++: lambda capturing structured bindings [PR85889]

    <https://wg21.link/p1381r1> clarifies that it's OK to capture structured
    bindings.

    [expr.prim.lambda.capture]/4 says "The identifier in a simple-capture shall
    denote a local entity" and [basic.pre]/3: "An entity is a [...] structured
    binding".

    It doesn't appear that this was made a DR, so, strictly speaking, we
    should have a -Wc++20-extensions warning, like clang++.

            PR c++/85889

    gcc/cp/ChangeLog:

            * lambda.cc (add_capture): Add a pedwarn for capturing structured
            bindings.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/decomp3.C: Use -Wno-c++20-extensions.
            * g++.dg/cpp1z/decomp60.C: New test.

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

* [Bug c++/85889] lambda expression can capture structured bindings
       [not found] <bug-85889-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2024-05-09 17:03 ` cvs-commit at gcc dot gnu.org
@ 2024-05-09 17:05 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-05-09 17:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
A -Wc++20-extensions warning added in GCC 15.

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

end of thread, other threads:[~2024-05-09 17:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-85889-4@http.gcc.gnu.org/bugzilla/>
2022-11-02  0:21 ` [Bug c++/85889] lambda expression can capture structured bindings ville.voutilainen at gmail dot com
2022-11-02  0:30 ` ville.voutilainen at gmail dot com
2024-05-09 17:03 ` cvs-commit at gcc dot gnu.org
2024-05-09 17:05 ` mpolacek 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).