public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105541] New: ICE: Segmentation fault when template lambda in requires-clause
@ 2022-05-10  2:24 hewillk at gmail dot com
  2022-05-10  2:26 ` [Bug c++/105541] " hewillk at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: hewillk at gmail dot com @ 2022-05-10  2:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105541
           Summary: ICE: Segmentation fault when template lambda in
                    requires-clause
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

template<class>
constexpr bool is_hello = false;

template <typename T>
  requires (!is_hello<T>)
class Hello;

template <typename T>
  requires (!is_hello<T>)
class Hello {};

static_assert(requires { []<Hello<int>>{}; });

https://godbolt.org/z/rTM5chYf3

GCC-11 rejects this valid syntax, and GCC-12 emits ICE.

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

* [Bug c++/105541] ICE: Segmentation fault when template lambda in requires-clause
  2022-05-10  2:24 [Bug c++/105541] New: ICE: Segmentation fault when template lambda in requires-clause hewillk at gmail dot com
@ 2022-05-10  2:26 ` hewillk at gmail dot com
  2022-05-10  7:50 ` [Bug c++/105541] [12/13 Regression] " rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hewillk at gmail dot com @ 2022-05-10  2:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to 康桓瑋 from comment #0)
> template<class>
> constexpr bool is_hello = false;
> 
> template <typename T>
>   requires (!is_hello<T>)
> class Hello;
> 
> template <typename T>
>   requires (!is_hello<T>)
> class Hello {};
> 
> static_assert(requires { []<Hello<int>>{}; });
> 
> https://godbolt.org/z/rTM5chYf3
> 
> GCC-11 rejects this valid syntax, and GCC-12 emits ICE.

Sorry, GCC-11 compiles fine, this is a 12-regression.

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

* [Bug c++/105541] [12/13 Regression] ICE: Segmentation fault when template lambda in requires-clause
  2022-05-10  2:24 [Bug c++/105541] New: ICE: Segmentation fault when template lambda in requires-clause hewillk at gmail dot com
  2022-05-10  2:26 ` [Bug c++/105541] " hewillk at gmail dot com
@ 2022-05-10  7:50 ` rguenth at gcc dot gnu.org
  2022-05-10 13:46 ` mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-10  7:50 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.2
            Summary|ICE: Segmentation fault     |[12/13 Regression] ICE:
                   |when template lambda in     |Segmentation fault when
                   |requires-clause             |template lambda in
                   |                            |requires-clause

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

* [Bug c++/105541] [12/13 Regression] ICE: Segmentation fault when template lambda in requires-clause
  2022-05-10  2:24 [Bug c++/105541] New: ICE: Segmentation fault when template lambda in requires-clause hewillk at gmail dot com
  2022-05-10  2:26 ` [Bug c++/105541] " hewillk at gmail dot com
  2022-05-10  7:50 ` [Bug c++/105541] [12/13 Regression] " rguenth at gcc dot gnu.org
@ 2022-05-10 13:46 ` mpolacek at gcc dot gnu.org
  2022-05-10 22:18 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-05-10 13:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-05-10

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/105541] [12/13 Regression] ICE: Segmentation fault when template lambda in requires-clause
  2022-05-10  2:24 [Bug c++/105541] New: ICE: Segmentation fault when template lambda in requires-clause hewillk at gmail dot com
                   ` (2 preceding siblings ...)
  2022-05-10 13:46 ` mpolacek at gcc dot gnu.org
@ 2022-05-10 22:18 ` jason at gcc dot gnu.org
  2022-05-10 22:22 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2022-05-10 22:18 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |ice-on-valid-code
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
                 CC|                            |jason at gcc dot gnu.org
           Priority|P3                          |P1
             Status|NEW                         |ASSIGNED

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
P1 then.  Broken by my r12-7997-g1de6612d994ada.

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

* [Bug c++/105541] [12/13 Regression] ICE: Segmentation fault when template lambda in requires-clause
  2022-05-10  2:24 [Bug c++/105541] New: ICE: Segmentation fault when template lambda in requires-clause hewillk at gmail dot com
                   ` (3 preceding siblings ...)
  2022-05-10 22:18 ` jason at gcc dot gnu.org
@ 2022-05-10 22:22 ` jason at gcc dot gnu.org
  2022-05-11 19:30 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2022-05-10 22:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Simpler:

static_assert(requires { []<typename T>{}; });

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

* [Bug c++/105541] [12/13 Regression] ICE: Segmentation fault when template lambda in requires-clause
  2022-05-10  2:24 [Bug c++/105541] New: ICE: Segmentation fault when template lambda in requires-clause hewillk at gmail dot com
                   ` (4 preceding siblings ...)
  2022-05-10 22:22 ` jason at gcc dot gnu.org
@ 2022-05-11 19:30 ` cvs-commit at gcc dot gnu.org
  2022-07-01 14:56 ` [Bug c++/105541] [12 " cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-11 19:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:88459c3965e2a2f62ab4d4c8b2ac8460b1a15c33

commit r13-332-g88459c3965e2a2f62ab4d4c8b2ac8460b1a15c33
Author: Jason Merrill <jason@redhat.com>
Date:   Wed May 11 14:53:26 2022 -0400

    c++: lambda template in requires [PR105541]

    Since the patch for PR103408, the template parameters for the lambda in
this
    test have level 1 instead of 2, and we were treating null template args as
1
    level of arguments, so tsubst_template_parms decided it had nothing to do.
    Fixed by distinguishing between <> and no args at all, which is what we
have
    in our "substitution" in a requires-expression.

            PR c++/105541

    gcc/cp/ChangeLog:

            * cp-tree.h (TMPL_ARGS_DEPTH): 0 for null args.
            * parser.cc (cp_parser_enclosed_template_argument_list):
            Use 0-length TREE_VEC for <>.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/lambda-requires1.C: New test.

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

* [Bug c++/105541] [12 Regression] ICE: Segmentation fault when template lambda in requires-clause
  2022-05-10  2:24 [Bug c++/105541] New: ICE: Segmentation fault when template lambda in requires-clause hewillk at gmail dot com
                   ` (5 preceding siblings ...)
  2022-05-11 19:30 ` cvs-commit at gcc dot gnu.org
@ 2022-07-01 14:56 ` cvs-commit at gcc dot gnu.org
  2022-07-01 14:57 ` jason at gcc dot gnu.org
  2023-05-25 13:10 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-01 14:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:b1c8ee2627696717013ebdb1ca3f5f97a76b1cb9

commit r12-8535-gb1c8ee2627696717013ebdb1ca3f5f97a76b1cb9
Author: Jason Merrill <jason@redhat.com>
Date:   Wed May 11 14:53:26 2022 -0400

    c++: lambda template in requires [PR105541]

    Since the patch for PR103408, the template parameters for the lambda in
this
    test have level 1 instead of 2, and we were treating null template args as
1
    level of arguments, so tsubst_template_parms decided it had nothing to do.
    Fixed by distinguishing between <> and no args at all, which is what we
have
    in our "substitution" in a requires-expression.

            PR c++/105541

    gcc/cp/ChangeLog:

            * cp-tree.h (TMPL_ARGS_DEPTH): 0 for null args.
            * parser.cc (cp_parser_enclosed_template_argument_list):
            Use 0-length TREE_VEC for <>.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/lambda-requires1.C: New test.

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

* [Bug c++/105541] [12 Regression] ICE: Segmentation fault when template lambda in requires-clause
  2022-05-10  2:24 [Bug c++/105541] New: ICE: Segmentation fault when template lambda in requires-clause hewillk at gmail dot com
                   ` (6 preceding siblings ...)
  2022-07-01 14:56 ` [Bug c++/105541] [12 " cvs-commit at gcc dot gnu.org
@ 2022-07-01 14:57 ` jason at gcc dot gnu.org
  2023-05-25 13:10 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2022-07-01 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 12.2.

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

* [Bug c++/105541] [12 Regression] ICE: Segmentation fault when template lambda in requires-clause
  2022-05-10  2:24 [Bug c++/105541] New: ICE: Segmentation fault when template lambda in requires-clause hewillk at gmail dot com
                   ` (7 preceding siblings ...)
  2022-07-01 14:57 ` jason at gcc dot gnu.org
@ 2023-05-25 13:10 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-05-25 13:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2023-05-25 13:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10  2:24 [Bug c++/105541] New: ICE: Segmentation fault when template lambda in requires-clause hewillk at gmail dot com
2022-05-10  2:26 ` [Bug c++/105541] " hewillk at gmail dot com
2022-05-10  7:50 ` [Bug c++/105541] [12/13 Regression] " rguenth at gcc dot gnu.org
2022-05-10 13:46 ` mpolacek at gcc dot gnu.org
2022-05-10 22:18 ` jason at gcc dot gnu.org
2022-05-10 22:22 ` jason at gcc dot gnu.org
2022-05-11 19:30 ` cvs-commit at gcc dot gnu.org
2022-07-01 14:56 ` [Bug c++/105541] [12 " cvs-commit at gcc dot gnu.org
2022-07-01 14:57 ` jason at gcc dot gnu.org
2023-05-25 13:10 ` 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).