[Bug c++/88826] New: ICE (segfault) when compiling invalid C++ code with -std=c++2a

su at cs dot ucdavis.edu gcc-bugzilla@gcc.gnu.org
Sun Jan 13 17:16:00 GMT 2019


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

            Bug ID: 88826
           Summary: ICE (segfault) when compiling invalid C++ code with
                    -std=c++2a
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

This appears to be a recent regression.

$ g++tk -v
Using built-in specs.
COLLECT_GCC=g++tk
COLLECT_LTO_WRAPPER=/home/su/software/tmp/gcc/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/home/su/software/tmp/gcc/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 9.0.0 20190112 (experimental) [trunk revision 267885] (GCC) 
$ 
$ g++tk -std=c++2a -c tmp.cpp
tmp.cpp:1:40: error: types may not be defined in parameter types
    1 | template < class A, class B : public A {}; > void f ();
      |                                        ^
tmp.cpp:1:41: error: ‘B’ is not a valid type for a template non-type parameter
because it is not literal
    1 | template < class A, class B : public A {}; > void f ();
      |                                         ^
tmp.cpp:1:27: note: ‘B’ is not literal because:
    1 | template < class A, class B : public A {}; > void f ();
      |                           ^
tmp.cpp:1:41: internal compiler error: Segmentation fault
    1 | template < class A, class B : public A {}; > void f ();
      |                                         ^
0xec3aff crash_signal
        ../../gcc-source-trunk/gcc/toplev.c:326
0x6db371 explain_non_literal_class(tree_node*)
        ../../gcc-source-trunk/gcc/cp/class.c:5516
0x82bce7 invalid_nontype_parm_type_p
        ../../gcc-source-trunk/gcc/cp/pt.c:24929
0x849768 process_template_parm(tree_node*, unsigned int, tree_node*, bool,
bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:4316
0x81d79e cp_parser_template_parameter_list
        ../../gcc-source-trunk/gcc/cp/parser.c:15565
0x82145b cp_parser_explicit_template_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:27910
0x82145b cp_parser_template_declaration_after_export
        ../../gcc-source-trunk/gcc/cp/parser.c:27944
0x829129 cp_parser_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:13116
0x827e0e cp_parser_translation_unit
        ../../gcc-source-trunk/gcc/cp/parser.c:4692
0x827e0e c_parse_file()
        ../../gcc-source-trunk/gcc/cp/parser.c:40993
0x981bca c_common_parse_file()
        ../../gcc-source-trunk/gcc/c-family/c-opts.c:1151
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.
$ 


---------------------------------------------------------


template < class A, class B : public A {}; > void f ();


More information about the Gcc-bugs mailing list