public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109859] New: ICE on concept mis-typed as template type parameter
@ 2023-05-15  8:53 saifi.khan at nishan dot io
  2023-05-15  9:22 ` [Bug c++/109859] " hewillk at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: saifi.khan at nishan dot io @ 2023-05-15  8:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109859
           Summary: ICE on concept mis-typed as template type parameter
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: saifi.khan at nishan dot io
  Target Milestone: ---

while exploring ranges, i mis-typed the code as follows.

should have written

template <std::ranges::random_access_range R>

--

#include <ranges>

template <typename R = std::ranges::random_access_range>

int  fn (R);

int main () {;}

--

using gcc version 14.0.0 20230514 (experimental) (GCC)

g++ -std=c++23 file.cc

--

output is

file.cc:3:37: internal compiler error: in cp_parser_placeholder_type_specifier,
at cp/parser.cc:20242
    3 | template <typename R = std::ranges::random_access_range>
      |                                     ^~~~~~~~~~~~~~~~~~~
0x75a5de cp_parser_placeholder_type_specifier
        /opt/gcc/src/gcc/cp/parser.cc:20242
0xbb9e11 cp_parser_simple_type_specifier
        /opt/gcc/src/gcc/cp/parser.cc:20079
0xb8ec55 cp_parser_type_specifier
        /opt/gcc/src/gcc/cp/parser.cc:19614
0xba3e42 cp_parser_type_specifier_seq
        /opt/gcc/src/gcc/cp/parser.cc:24615
0xba1a3d cp_parser_type_id_1
        /opt/gcc/src/gcc/cp/parser.cc:24412
0xba1d50 cp_parser_type_id
        /opt/gcc/src/gcc/cp/parser.cc:24511
0xba1d50 cp_parser_default_type_template_argument
        /opt/gcc/src/gcc/cp/parser.cc:17963
0xbb5617 cp_parser_type_parameter
        /opt/gcc/src/gcc/cp/parser.cc:18199
0xbb46d4 cp_parser_template_parameter
        /opt/gcc/src/gcc/cp/parser.cc:18080
0xbb46d4 cp_parser_template_parameter_list
        /opt/gcc/src/gcc/cp/parser.cc:17679
0xbc6ce7 cp_parser_explicit_template_declaration
        /opt/gcc/src/gcc/cp/parser.cc:32382
0xbc9a95 cp_parser_declaration
        /opt/gcc/src/gcc/cp/parser.cc:15050
0xbca553 cp_parser_toplevel_declaration
        /opt/gcc/src/gcc/cp/parser.cc:15142
0xbca553 cp_parser_translation_unit
        /opt/gcc/src/gcc/cp/parser.cc:5131
0xbca553 c_parse_file()
        /opt/gcc/src/gcc/cp/parser.cc:49635
0xd17685 c_common_parse_file()
        /opt/gcc/src/gcc/c-family/c-opts.cc:1248

---

Thanks for your time !

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

* [Bug c++/109859] ICE on concept mis-typed as template type parameter
  2023-05-15  8:53 [Bug c++/109859] New: ICE on concept mis-typed as template type parameter saifi.khan at nishan dot io
@ 2023-05-15  9:22 ` hewillk at gmail dot com
  2023-05-15 14:47 ` [Bug c++/109859] [12/13/14 Regression] " pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hewillk at gmail dot com @ 2023-05-15  9:22 UTC (permalink / raw)
  To: gcc-bugs

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

康桓瑋 <hewillk at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hewillk at gmail dot com

--- Comment #1 from 康桓瑋 <hewillk at gmail dot com> ---
Reduced:

template<class>
concept C = true;

template <class = C>
int f();

https://godbolt.org/z/59739vMbj

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

* [Bug c++/109859] [12/13/14 Regression] ICE on concept mis-typed as template type parameter
  2023-05-15  8:53 [Bug c++/109859] New: ICE on concept mis-typed as template type parameter saifi.khan at nishan dot io
  2023-05-15  9:22 ` [Bug c++/109859] " hewillk at gmail dot com
@ 2023-05-15 14:47 ` pinskia at gcc dot gnu.org
  2023-05-15 14:47 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-15 14:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
   Target Milestone|---                         |12.4
            Summary|ICE on concept mis-typed as |[12/13/14 Regression] ICE
                   |template type parameter     |on concept mis-typed as
                   |                            |template type parameter

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
In GCC 11 and before, GCC would accept the reduced testcase but didn't ICE.

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

* [Bug c++/109859] [12/13/14 Regression] ICE on concept mis-typed as template type parameter
  2023-05-15  8:53 [Bug c++/109859] New: ICE on concept mis-typed as template type parameter saifi.khan at nishan dot io
  2023-05-15  9:22 ` [Bug c++/109859] " hewillk at gmail dot com
  2023-05-15 14:47 ` [Bug c++/109859] [12/13/14 Regression] " pinskia at gcc dot gnu.org
@ 2023-05-15 14:47 ` pinskia at gcc dot gnu.org
  2023-05-17  6:44 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-15 14:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-05-15

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

* [Bug c++/109859] [12/13/14 Regression] ICE on concept mis-typed as template type parameter
  2023-05-15  8:53 [Bug c++/109859] New: ICE on concept mis-typed as template type parameter saifi.khan at nishan dot io
                   ` (2 preceding siblings ...)
  2023-05-15 14:47 ` pinskia at gcc dot gnu.org
@ 2023-05-17  6:44 ` rguenth at gcc dot gnu.org
  2023-08-29  5:53 ` pinskia at gcc dot gnu.org
  2024-02-16 18:54 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-05-17  6:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c++/109859] [12/13/14 Regression] ICE on concept mis-typed as template type parameter
  2023-05-15  8:53 [Bug c++/109859] New: ICE on concept mis-typed as template type parameter saifi.khan at nishan dot io
                   ` (3 preceding siblings ...)
  2023-05-17  6:44 ` rguenth at gcc dot gnu.org
@ 2023-08-29  5:53 ` pinskia at gcc dot gnu.org
  2024-02-16 18:54 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-29  5:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stevenxia990430 at gmail dot com

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 111220 has been marked as a duplicate of this bug. ***

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

* [Bug c++/109859] [12/13/14 Regression] ICE on concept mis-typed as template type parameter
  2023-05-15  8:53 [Bug c++/109859] New: ICE on concept mis-typed as template type parameter saifi.khan at nishan dot io
                   ` (4 preceding siblings ...)
  2023-08-29  5:53 ` pinskia at gcc dot gnu.org
@ 2024-02-16 18:54 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-02-16 18:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We're hitting the assert here:

  /* In a template parameter list, a type-parameter can be introduced
     by type-constraints alone.  */
  if (processing_template_parmlist && !placeholder)
    {
      /* In a default argument we may not be creating new parameters.  */
      if (parser->local_variables_forbidden_p & LOCAL_VARS_FORBIDDEN)
        {
          /* If this assert turns out to be false, do error() instead.  */
          gcc_assert (tentative);
          return error_mark_node;
        }

so presumably we should change it to error() as the comment says.

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

end of thread, other threads:[~2024-02-16 18:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-15  8:53 [Bug c++/109859] New: ICE on concept mis-typed as template type parameter saifi.khan at nishan dot io
2023-05-15  9:22 ` [Bug c++/109859] " hewillk at gmail dot com
2023-05-15 14:47 ` [Bug c++/109859] [12/13/14 Regression] " pinskia at gcc dot gnu.org
2023-05-15 14:47 ` pinskia at gcc dot gnu.org
2023-05-17  6:44 ` rguenth at gcc dot gnu.org
2023-08-29  5:53 ` pinskia at gcc dot gnu.org
2024-02-16 18:54 ` mpolacek 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).