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

--- Comment #1 from Anonymous <iamanonymous.cs at gmail dot com> ---
*******************************************************************************
The compiler produces an internal error in lookup_template_class 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
*******************************************************************************
# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/root/gdbtest/gcc/gcc-15/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /root/gdbtest/gcc/obj/../gcc/configure
--prefix=/root/gdbtest/gcc/gcc-15 --enable-languages=c,c++,fortran,go
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20240509 (experimental) (GCC) 
*******************************************************************************
Program:
# cat source_code_1.cpp

template <class... Ts>
auto f(Ts...) {
  [] { enum class e : Ts {}; };
}

int main() {
  f(0, true);
}


*******************************************************************************
Command Lines:
# g++ source_code_1.cpp  -std=c++2a -Wall -Wextra -pedantic
-fsanitize=undefined -fsanitize=address -O2 -c -o source_code_1.o
source_code_1.cpp: In instantiation of ‘auto f(Ts ...) [with Ts = {int,
bool}]’:
source_code_1.cpp:7:4:   required from here
    7 |   f(0, true);
      |   ~^~~~~~~~~
source_code_1.cpp:3:19: internal compiler error: in dependent_type_p, at
cp/pt.cc:28020
    3 |   [] { enum class e : Ts {}; };
      |                   ^
0x825d35 dependent_type_p(tree_node*)
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:28020
0xb55fd3 start_enum(tree_node*, tree_node*, tree_node*, tree_node*, bool,
bool*)
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/decl.cc:17113
0xcde80b lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int)
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:10268
0xcd2cd0 tsubst(tree_node*, tree_node*, int, tree_node*)
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:16265
0xccf2d4 tsubst_decl
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:15435
0xcc77e4 tsubst_stmt
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:18541
0xcc6106 tsubst_stmt
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:18410
0xcc6106 tsubst_stmt
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:18424
0xcc6bee tsubst_stmt
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:18797
0xce1718 tsubst_stmt
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:18410
0xce1718 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:19850
0xcbe1a0 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:21757
0xcc4837 tsubst_stmt
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:19482
0xcc55cc tsubst_stmt
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:18442
0xcc6106 tsubst_stmt
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:18410
0xcc6106 tsubst_stmt
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:18424
0xcc6bee tsubst_stmt
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:18797
0xce0b52 tsubst_stmt
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:18410
0xce0b52 instantiate_body
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:27107
0xcc4425 instantiate_decl(tree_node*, bool, bool)
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/pt.cc:27392
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.

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

Also ICE on trunk, compiler explorer:https://godbolt.org/z/7aPr9fWxn

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

Reply via email to