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

            Bug ID: 120575
           Summary: ICE: in cp_parser_abort_tentative_parse, at
                    cp/parser.cc:36574
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---
            Target: x86_64

*******************************************************************************
The compiler produces an internal error during cp_parser_abort_tentative_parse
when compiling the provided code with the specified options. 
The issue can also be reproduced on Compiler Explorer.

*******************************************************************************
OS and Platform:
# uname -a
Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023
x86_64 x86_64 x86_64 GNU/Linux
*******************************************************************************
# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/root/gdbtest/gcc/gcc-250601/libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gdbtest/gcc/gcc-250601
--enable-languages=c,c++ --disable-multilib --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 16.0.0 20250601 (experimental) (GCC)
*******************************************************************************
Program:
#cat code.cpp

template< int >
struct T {};

template< int >
struct S {

  operator typename T< oops >::anything () {};

};

*******************************************************************************
Command Lines:
gcc code.cpp -fpermissive -Wno-unknown-pragmas  -c -o code_0.o

<source>:7:24: warning: 'oops' was not declared in this scope [-Wtemplate-body]
    7 |   operator typename T< oops >::anything () {};
      |                        ^~~~
<source>:7:29: warning: template argument 1 is invalid [-Wtemplate-body]
    7 |   operator typename T< oops >::anything () {};
      |                             ^
<source>:7:32: internal compiler error: in cp_parser_abort_tentative_parse, at
cp/parser.cc:36652
    7 |   operator typename T< oops >::anything () {};
      |                                ^~~~~~~~
0x282f1c5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x284d556 internal_error(char const*, ...)
        ???:0
0xadeeec fancy_abort(char const*, int, char const*)
        ???:0
0xd049b3 c_parse_file()
        ???:0
0xe6c5b9 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
*******************************************************************************

Also ICE on trunk, compiler explorer:https://gcc.godbolt.org/z/3TGKrT4Ph

*******************************************************************************

Reply via email to