[Bug c++/88825] New: ICE on (invalid) C++11 code: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in can_do_nrvo_p, at cp/typeck.c:9361

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


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

            Bug ID: 88825
           Summary: ICE on (invalid) C++11 code: tree check: expected
                    class ‘type’, have ‘exceptional’ (error_mark) in
                    can_do_nrvo_p, at cp/typeck.c:9361
           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 seems 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 -c tmp.cpp
tmp.cpp: In function ‘auto* f()’:
tmp.cpp:4:10: error: unable to deduce ‘auto*’ from ‘t’
    4 |   return t;
      |          ^
tmp.cpp:4:10: note:   mismatched types ‘auto*’ and ‘int’
tmp.cpp:4:10: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in can_do_nrvo_p, at cp/typeck.c:9361
0x608e99 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc-source-trunk/gcc/tree.c:9864
0x8fee4b tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        ../../gcc-source-trunk/gcc/tree.h:3299
0x8fee4b can_do_nrvo_p
        ../../gcc-source-trunk/gcc/cp/typeck.c:9360
0x9126ae check_return_expr(tree_node*, bool*)
        ../../gcc-source-trunk/gcc/cp/typeck.c:9671
0x8b065e finish_return_stmt(tree_node*)
        ../../gcc-source-trunk/gcc/cp/semantics.c:895
0x805227 cp_parser_jump_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:12848
0x805227 cp_parser_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:11120
0x805d4f cp_parser_statement_seq_opt
        ../../gcc-source-trunk/gcc/cp/parser.c:11586
0x805e5f cp_parser_compound_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:11540
0x806560 cp_parser_function_body
        ../../gcc-source-trunk/gcc/cp/parser.c:22523
0x806560 cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc-source-trunk/gcc/cp/parser.c:22558
0x806912 cp_parser_function_definition_after_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:27621
0x81ef1a cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:27538
0x81ef1a cp_parser_init_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:20196
0x81f3c5 cp_parser_simple_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:13480
0x829104 cp_parser_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:13167
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.
$ 


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


auto f () -> auto *
{
  int t = 0;
  return t;
}


More information about the Gcc-bugs mailing list