public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95069] New: Capture by reference cannot use list-initalization
@ 2020-05-11 22:07 redi at gcc dot gnu.org
  2020-05-12 14:13 ` [Bug c++/95069] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-11 22:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95069
           Summary: Capture by reference cannot use list-initalization
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

int i;
int& f(int& i) { return i; }
auto ok = [&x = f(i)] {};
auto err = [&x{f(i)}] {};

Clang, EDG and MSVC accept this in C++14 mode, but G++ doesn't:

l.cc:4:20: error: cannot capture ‘{f(i)}’ by reference
    4 | auto err = [&x{f(i)}] {};
      |                    ^

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

* [Bug c++/95069] Capture by reference cannot use list-initalization
  2020-05-11 22:07 [Bug c++/95069] New: Capture by reference cannot use list-initalization redi at gcc dot gnu.org
@ 2020-05-12 14:13 ` redi at gcc dot gnu.org
  2020-05-12 14:15 ` redi at gcc dot gnu.org
  2022-02-08 14:58 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-12 14:13 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nico at josuttis dot de

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 95086 has been marked as a duplicate of this bug. ***

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

* [Bug c++/95069] Capture by reference cannot use list-initalization
  2020-05-11 22:07 [Bug c++/95069] New: Capture by reference cannot use list-initalization redi at gcc dot gnu.org
  2020-05-12 14:13 ` [Bug c++/95069] " redi at gcc dot gnu.org
@ 2020-05-12 14:15 ` redi at gcc dot gnu.org
  2022-02-08 14:58 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-12 14:15 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-05-12
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:

int i;
auto ok = [&x = i] {};
auto err = [&x{i}] {};

l.cc:3:17: error: cannot capture '{i}' by reference
    3 | auto err = [&x{i}] {};
      |                 ^

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

* [Bug c++/95069] Capture by reference cannot use list-initalization
  2020-05-11 22:07 [Bug c++/95069] New: Capture by reference cannot use list-initalization redi at gcc dot gnu.org
  2020-05-12 14:13 ` [Bug c++/95069] " redi at gcc dot gnu.org
  2020-05-12 14:15 ` redi at gcc dot gnu.org
@ 2022-02-08 14:58 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-02-08 14:58 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |oliver.rosten at googlemail dot co
                   |                            |m

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 104411 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2022-02-08 14:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11 22:07 [Bug c++/95069] New: Capture by reference cannot use list-initalization redi at gcc dot gnu.org
2020-05-12 14:13 ` [Bug c++/95069] " redi at gcc dot gnu.org
2020-05-12 14:15 ` redi at gcc dot gnu.org
2022-02-08 14:58 ` ppalka 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).