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

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