public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95455] New: ICE in capture with initializer in requires block
@ 2020-06-01  6:30 bhalevy at gmail dot com
  2020-06-01  8:33 ` [Bug c++/95455] " marxin at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: bhalevy at gmail dot com @ 2020-06-01  6:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95455
           Summary: ICE in capture with initializer in requires block
           Product: gcc
           Version: 10.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bhalevy at gmail dot com
  Target Milestone: ---

Created attachment 48650
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48650&action=edit
Preprocessed source

Compiling the following code hits ICE, as follows:

testcase.cc:
void f() {
    int foo;
    requires () {
        [bar = foo] {};
    };
}

$ g++ --std=gnu++20 testcase.cc
testcase.cc: In function ‘void f()’:
testcase.cc:4:16: internal compiler error: Segmentation fault
    4 |         [bar = foo] {};
      |                ^~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccVYMnnA.out file, please attach this to
your bugreport.

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

* [Bug c++/95455] ICE in capture with initializer in requires block
  2020-06-01  6:30 [Bug c++/95455] New: ICE in capture with initializer in requires block bhalevy at gmail dot com
@ 2020-06-01  8:33 ` marxin at gcc dot gnu.org
  2020-06-01  8:40 ` avi@cloudius-systems.com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-06-01  8:33 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2020-06-01
             Status|UNCONFIRMED                 |WAITING

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, is it a valid or invalid source?

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

* [Bug c++/95455] ICE in capture with initializer in requires block
  2020-06-01  6:30 [Bug c++/95455] New: ICE in capture with initializer in requires block bhalevy at gmail dot com
  2020-06-01  8:33 ` [Bug c++/95455] " marxin at gcc dot gnu.org
@ 2020-06-01  8:40 ` avi@cloudius-systems.com
  2020-06-01  8:45 ` avi@cloudius-systems.com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: avi@cloudius-systems.com @ 2020-06-01  8:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Avi Kivity <avi@cloudius-systems.com> ---
Appears to be invalid. Clang rejects it even after some massaging (lambda in
unevaluated context).

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

* [Bug c++/95455] ICE in capture with initializer in requires block
  2020-06-01  6:30 [Bug c++/95455] New: ICE in capture with initializer in requires block bhalevy at gmail dot com
  2020-06-01  8:33 ` [Bug c++/95455] " marxin at gcc dot gnu.org
  2020-06-01  8:40 ` avi@cloudius-systems.com
@ 2020-06-01  8:45 ` avi@cloudius-systems.com
  2020-06-01  8:46 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: avi@cloudius-systems.com @ 2020-06-01  8:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Avi Kivity <avi@cloudius-systems.com> ---
Here's a valid version (which gcc accepts):

void f() {
    int foo = 4;
    auto lambda = [bar = foo] {};
    static_assert(requires (decltype(lambda) x) {
        x;
    });
}

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

* [Bug c++/95455] ICE in capture with initializer in requires block
  2020-06-01  6:30 [Bug c++/95455] New: ICE in capture with initializer in requires block bhalevy at gmail dot com
                   ` (2 preceding siblings ...)
  2020-06-01  8:45 ` avi@cloudius-systems.com
@ 2020-06-01  8:46 ` marxin at gcc dot gnu.org
  2020-06-01  9:06 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-06-01  8:46 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
           Keywords|                            |ice-on-invalid-code

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

* [Bug c++/95455] ICE in capture with initializer in requires block
  2020-06-01  6:30 [Bug c++/95455] New: ICE in capture with initializer in requires block bhalevy at gmail dot com
                   ` (3 preceding siblings ...)
  2020-06-01  8:46 ` marxin at gcc dot gnu.org
@ 2020-06-01  9:06 ` jakub at gcc dot gnu.org
  2021-08-08  9:25 ` pinskia at gcc dot gnu.org
  2024-04-14  8:41 ` egor.pugin at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-06-01  9:06 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Lambdas in unevaluated contexts should be valid since P0315R4 which is (so far)
only implemented in GCC but not clang nor other compilers.
So I'm not sure about the invalid classification.

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

* [Bug c++/95455] ICE in capture with initializer in requires block
  2020-06-01  6:30 [Bug c++/95455] New: ICE in capture with initializer in requires block bhalevy at gmail dot com
                   ` (4 preceding siblings ...)
  2020-06-01  9:06 ` jakub at gcc dot gnu.org
@ 2021-08-08  9:25 ` pinskia at gcc dot gnu.org
  2024-04-14  8:41 ` egor.pugin at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-08  9:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Clang gives:
<source>:5:16: error: reference to local variable 'foo' declared in enclosing
function 'f'
        [bar = foo] {};
               ^
<source>:3:9: note: 'foo' declared here
    int foo;
        ^

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

* [Bug c++/95455] ICE in capture with initializer in requires block
  2020-06-01  6:30 [Bug c++/95455] New: ICE in capture with initializer in requires block bhalevy at gmail dot com
                   ` (5 preceding siblings ...)
  2021-08-08  9:25 ` pinskia at gcc dot gnu.org
@ 2024-04-14  8:41 ` egor.pugin at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: egor.pugin at gmail dot com @ 2024-04-14  8:41 UTC (permalink / raw)
  To: gcc-bugs

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

Egor Pugin <egor.pugin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egor.pugin at gmail dot com

--- Comment #6 from Egor Pugin <egor.pugin at gmail dot com> ---
10.5 - ice
11.4 - ice
12.3 - ok
13.2 - ok
14.x - ice

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

end of thread, other threads:[~2024-04-14  8:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01  6:30 [Bug c++/95455] New: ICE in capture with initializer in requires block bhalevy at gmail dot com
2020-06-01  8:33 ` [Bug c++/95455] " marxin at gcc dot gnu.org
2020-06-01  8:40 ` avi@cloudius-systems.com
2020-06-01  8:45 ` avi@cloudius-systems.com
2020-06-01  8:46 ` marxin at gcc dot gnu.org
2020-06-01  9:06 ` jakub at gcc dot gnu.org
2021-08-08  9:25 ` pinskia at gcc dot gnu.org
2024-04-14  8:41 ` egor.pugin at gmail dot com

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