public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110584] New: Constant is not visible in nested lambda
@ 2023-07-07  9:06 fchelnokov at gmail dot com
  2023-07-07  9:45 ` [Bug c++/110584] Constant is not visible in nested lambda with outer lambda having a default capture pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: fchelnokov at gmail dot com @ 2023-07-07  9:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110584
           Summary: Constant is not visible in nested lambda
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

This program (created by my colleague Artur)

void foo(float);
int main() {
    constexpr float x = 0;
    (void)[&] () {
        foo(x);
        (void)[] () {
            foo(x);
        };
    };
}

is accepted in Clang and MSVC, but GCC complains:

error: 'x' is not captured
note: the lambda has no capture-default
'const float& x' declared here
    5 |         foo(x);

Online demo: https://gcc.godbolt.org/z/dY8bPhMYc

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

* [Bug c++/110584] Constant is not visible in nested lambda with outer lambda having a default capture
  2023-07-07  9:06 [Bug c++/110584] New: Constant is not visible in nested lambda fchelnokov at gmail dot com
@ 2023-07-07  9:45 ` pinskia at gcc dot gnu.org
  2023-07-07  9:47 ` [Bug c++/110584] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-07  9:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-07-07
           Keywords|                            |rejects-valid
            Summary|Constant is not visible in  |Constant is not visible in
                   |nested lambda               |nested lambda with outer
                   |                            |lambda having a default
                   |                            |capture
     Ever confirmed|0                           |1

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

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

* [Bug c++/110584] [11/12/13/14 Regression] Constant is not visible in nested lambda with outer lambda having a default capture
  2023-07-07  9:06 [Bug c++/110584] New: Constant is not visible in nested lambda fchelnokov at gmail dot com
  2023-07-07  9:45 ` [Bug c++/110584] Constant is not visible in nested lambda with outer lambda having a default capture pinskia at gcc dot gnu.org
@ 2023-07-07  9:47 ` pinskia at gcc dot gnu.org
  2023-07-12 13:53 ` ppalka at gcc dot gnu.org
  2024-03-07 23:29 ` law at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-07  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.5
           Keywords|                            |needs-bisection
            Summary|Constant is not visible in  |[11/12/13/14 Regression]
                   |nested lambda with outer    |Constant is not visible in
                   |lambda having a default     |nested lambda with outer
                   |capture                     |lambda having a default
                   |                            |capture
      Known to work|                            |6.4.0, 7.1.0, 7.5.0
      Known to fail|                            |8.1.0

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

* [Bug c++/110584] [11/12/13/14 Regression] Constant is not visible in nested lambda with outer lambda having a default capture
  2023-07-07  9:06 [Bug c++/110584] New: Constant is not visible in nested lambda fchelnokov at gmail dot com
  2023-07-07  9:45 ` [Bug c++/110584] Constant is not visible in nested lambda with outer lambda having a default capture pinskia at gcc dot gnu.org
  2023-07-07  9:47 ` [Bug c++/110584] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
@ 2023-07-12 13:53 ` ppalka at gcc dot gnu.org
  2024-03-07 23:29 ` law at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-07-12 13:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Started with r8-4571-gc1051bf7d8c99d.

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

* [Bug c++/110584] [11/12/13/14 Regression] Constant is not visible in nested lambda with outer lambda having a default capture
  2023-07-07  9:06 [Bug c++/110584] New: Constant is not visible in nested lambda fchelnokov at gmail dot com
                   ` (2 preceding siblings ...)
  2023-07-12 13:53 ` ppalka at gcc dot gnu.org
@ 2024-03-07 23:29 ` law at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-07 23:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org
           Priority|P3                          |P2

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

end of thread, other threads:[~2024-03-07 23:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-07  9:06 [Bug c++/110584] New: Constant is not visible in nested lambda fchelnokov at gmail dot com
2023-07-07  9:45 ` [Bug c++/110584] Constant is not visible in nested lambda with outer lambda having a default capture pinskia at gcc dot gnu.org
2023-07-07  9:47 ` [Bug c++/110584] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2023-07-12 13:53 ` ppalka at gcc dot gnu.org
2024-03-07 23:29 ` law 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).