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

            Bug ID: 77548
           Summary: ICE on invalid C++ code with overloaded functions: in
                    instantiate_type, at cp/class.c:8270
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

It affects at least all versions 4.6.x and later. 


$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160909 (experimental) [trunk revision 240043] (GCC)
$
$ g++-trunk -c small.cpp
small.cpp: In member function ‘int S::f(int)’:
small.cpp:6:31: internal compiler error: in instantiate_type, at
cp/class.c:8270
   int f (int)  { return f ? : 1; }
                               ^
0x7486f0 instantiate_type(tree_node*, tree_node*, int)
        ../../gcc-source-trunk/gcc/cp/class.c:8267
0x674764 perform_implicit_conversion_flags(tree_node*, tree_node*, int, int)
        ../../gcc-source-trunk/gcc/cp/call.c:9763
0x683c2f build_conditional_expr_1
        ../../gcc-source-trunk/gcc/cp/call.c:4812
0x6859dc build_conditional_expr(unsigned int, tree_node*, tree_node*,
tree_node*, int)
        ../../gcc-source-trunk/gcc/cp/call.c:5237
0x7cd1d0 build_x_conditional_expr(unsigned int, tree_node*, tree_node*,
tree_node*, int)
        ../../gcc-source-trunk/gcc/cp/typeck.c:6279
0x7a4b3b cp_parser_question_colon_clause
        ../../gcc-source-trunk/gcc/cp/parser.c:9054
0x7a4b3b cp_parser_assignment_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9090
0x7a7239 cp_parser_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9253
0x7b68c6 cp_parser_jump_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:11914
0x7b68c6 cp_parser_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:10467
0x7b711c cp_parser_statement_seq_opt
        ../../gcc-source-trunk/gcc/cp/parser.c:10859
0x7b720f cp_parser_compound_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:10813
0x7b73bf cp_parser_function_body
        ../../gcc-source-trunk/gcc/cp/parser.c:20832
0x7b73bf cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc-source-trunk/gcc/cp/parser.c:20868
0x7b7e61 cp_parser_function_definition_after_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:25565
0x7bbcc0 cp_parser_late_parsing_for_member
        ../../gcc-source-trunk/gcc/cp/parser.c:26446
0x796a96 cp_parser_class_specifier_1
        ../../gcc-source-trunk/gcc/cp/parser.c:21719
0x7983b9 cp_parser_class_specifier
        ../../gcc-source-trunk/gcc/cp/parser.c:21745
0x7983b9 cp_parser_type_specifier
        ../../gcc-source-trunk/gcc/cp/parser.c:15971
0x7abb33 cp_parser_decl_specifier_seq
        ../../gcc-source-trunk/gcc/cp/parser.c:12889
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$


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


struct S
{ 
  int f (void) { return 0; }

  // should be e.g.: int f (int) { return f() ? : 1; }
  int f (int)  { return f ? : 1; }
};

Reply via email to