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

            Bug ID: 89565
           Summary: [C++2a] ICE on template instantiating user defined
                    non-type template from template value member
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gccbugbjorn at fahller dot se
  Target Milestone: ---

This code:

template <auto>
struct N{};

template <N>
struct S {};

template <typename T>
using NS = S<T::value>;

ICE's gcc-trunk x86-64 built from svn revision 269349.

Error message is:

bf@rahonavis /tmp> /opt/gcc/bin/g++ -v -save-temps -std=c++2a t.cpp
Using built-in specs.
COLLECT_GCC=/opt/gcc/bin/g++
COLLECT_LTO_WRAPPER=/opt/gcc/libexec/gcc/x86_64-pc-linux-gnu/9.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/opt/gcc --with-languages='c
c++' --disable-multilib : (reconfigured) ../gcc-trunk/configure
--prefix=/opt/gcc --with-languages='c c++' --disable-multilib
Thread model: posix
gcc version 9.0.1 20190303 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++2a' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /opt/gcc/libexec/gcc/x86_64-pc-linux-gnu/9.0.1/cc1plus -E -quiet -v
-imultiarch x86_64-linux-gnu -D_GNU_SOURCE t.cpp -mtune=generic -march=x86-64
-std=c++2a -fpch-preprocess -o t.ii
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/opt/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.1/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.1/../../../../include/c++/9.0.1

/opt/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.1/../../../../include/c++/9.0.1/x86_64-pc-linux-gnu

/opt/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.1/../../../../include/c++/9.0.1/backward
 /opt/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.1/include
 /usr/local/include
 /opt/gcc/include
 /opt/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.1/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++2a' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /opt/gcc/libexec/gcc/x86_64-pc-linux-gnu/9.0.1/cc1plus -fpreprocessed t.ii
-quiet -dumpbase t.cpp -mtune=generic -march=x86-64 -auxbase t -std=c++2a
-version -o t.s
GNU C++17 (GCC) version 9.0.1 20190303 (experimental) (x86_64-pc-linux-gnu)
        compiled by GNU C version 9.0.1 20190302 (experimental), GMP version
6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C++17 (GCC) version 9.0.1 20190303 (experimental) (x86_64-pc-linux-gnu)
        compiled by GNU C version 9.0.1 20190302 (experimental), GMP version
6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 0d6a64c5f0e2a97428e482de5ff3bdff
t.cpp:8:22: internal compiler error: Segmentation fault
    8 | using NS = S<T::value>;
      |                      ^
0xf96b7f crash_signal
        ../../gcc-trunk/gcc/toplev.c:326
0x8a9caf resolve_args
        ../../gcc-trunk/gcc/cp/call.c:4244
0x8be187 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ../../gcc-trunk/gcc/cp/call.c:4363
0x9f411f do_class_deduction
        ../../gcc-trunk/gcc/cp/pt.c:27345
0x9f411f do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
        ../../gcc-trunk/gcc/cp/pt.c:27400
0xa18189 convert_template_argument
        ../../gcc-trunk/gcc/cp/pt.c:8045
0xa18189 convert_template_argument
        ../../gcc-trunk/gcc/cp/pt.c:7818
0xa023b3 coerce_template_parms
        ../../gcc-trunk/gcc/cp/pt.c:8546
0xa15ae9 lookup_template_class_1
        ../../gcc-trunk/gcc/cp/pt.c:9356
0xa15ae9 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../gcc-trunk/gcc/cp/pt.c:9715
0xa41ecb finish_template_type(tree_node*, tree_node*, int)
        ../../gcc-trunk/gcc/cp/semantics.c:3290
0x9bfa3d cp_parser_template_id
        ../../gcc-trunk/gcc/cp/parser.c:16422
0x9bfbd6 cp_parser_class_name
        ../../gcc-trunk/gcc/cp/parser.c:23195
0x9c31bb cp_parser_qualifying_entity
        ../../gcc-trunk/gcc/cp/parser.c:6693
0x9c31bb cp_parser_nested_name_specifier_opt
        ../../gcc-trunk/gcc/cp/parser.c:6379
0x9c0393 cp_parser_simple_type_specifier
        ../../gcc-trunk/gcc/cp/parser.c:17780
0x9b70a5 cp_parser_type_specifier
        ../../gcc-trunk/gcc/cp/parser.c:17448
0x9cad28 cp_parser_type_specifier_seq
        ../../gcc-trunk/gcc/cp/parser.c:21904
0x9c7de4 cp_parser_type_id_1
        ../../gcc-trunk/gcc/cp/parser.c:21733
0x9ccb73 cp_parser_type_id
        ../../gcc-trunk/gcc/cp/parser.c:21812
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


See also: https://gcc.godbolt.org/z/8UA0BC

Reply via email to