[Bug c++/92542] New: ICE with class template argument deduction following typo

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Nov 17 01:38:00 GMT 2019


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

            Bug ID: 92542
           Summary: ICE with class template argument deduction following
                    typo
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

template<typename T>
struct S
{
  S(T, T) { }
};

char* begin();
char* end();

void
test01()
{
  S s(begin(). end());  // should be comma not dot
}


Compiled with -std=gnu++17 this crashes:

guide-ice.cc: In function 'void test01()':
guide-ice.cc:13:16: error: request for member 'end' in 'begin()', which is of
non-class type 'char*'
   13 |   S s(begin(). end());
      |                ^~~
guide-ice.cc:13:21: error: class template argument deduction failed:
   13 |   S s(begin(). end());
      |                     ^
guide-ice.cc:13:21: internal compiler error: Segmentation fault
0xf84e9f crash_signal
        /home/jwakely/src/gcc/gcc/gcc/toplev.c:328
0x85aed5 add_candidates
        /home/jwakely/src/gcc/gcc/gcc/cp/call.c:5772
0x85fcdb add_candidates
        /home/jwakely/src/gcc/gcc/gcc/cp/call.c:4453
0x85fcdb perform_overload_resolution
        /home/jwakely/src/gcc/gcc/gcc/cp/call.c:4461
0x8663c2 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        /home/jwakely/src/gcc/gcc/gcc/cp/call.c:4535
0x9c32cf do_class_deduction
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.c:28191
0x9c32cf do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.c:28239
0x8ec69f cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        /home/jwakely/src/gcc/gcc/gcc/cp/decl.c:7383
0x997e3e cp_parser_init_declarator
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:20727
0x977b72 cp_parser_simple_declaration
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:13624
0x979939 cp_parser_declaration_statement
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:13055
0x97a583 cp_parser_statement
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:11380
0x97b508 cp_parser_statement_seq_opt
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:11742
0x97b5e7 cp_parser_compound_statement
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:11696
0x9940d0 cp_parser_function_body
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:22866
0x9940d0 cp_parser_ctor_initializer_opt_and_function_body
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:22917
0x997426 cp_parser_function_definition_after_declarator
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:28586
0x998233 cp_parser_function_definition_from_specifiers_and_declarator
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:28502
0x998233 cp_parser_init_declarator
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:20495
0x977b72 cp_parser_simple_declaration
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:13624
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.


More information about the Gcc-bugs mailing list