https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65340
Bug ID: 65340 Summary: [C++14]ICE in mark_used, at decl2.c:5040 Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lucdanton at free dot fr Created attachment 34981 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34981&action=edit Reduced testcase This is an ICE on invalid code. $ g++-trunk --version g++-trunk (GCC) 5.0.0 20150307 (experimental) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++-trunk -std=c++14 main.cpp main.cpp:4:34: error: expected identifier before ',' token struct recurse { auto operator()(, ) } ^ main.cpp:4:36: error: expected identifier before ')' token struct recurse { auto operator()(, ) } ^ main.cpp:4:36: error: expected ';' at end of member declaration main.cpp:4:38: error: expected ';' after struct definition struct recurse { auto operator()(, ) } ^ main.cpp:6:37: error: found ':' in nested-name-specifier, expected '::' auto &recurse = constant < functors : recurse > ^ main.cpp:7:1: error: expected ',' or ';' before '}' token } ^ main.cpp:12:44: error: found ':' in nested-name-specifier, expected '::' : recurse(0, 0)); ^ main.cpp:13:1: error: expected ';' after struct definition } ^ main.cpp:15:38: error: found ':' in nested-name-specifier, expected '::' auto &traverse = constant < functors : traverse > ; ^ main.cpp: In substitution of 'template<class Algo, class Value> decltype (reflect::recurse(0, 0)) functors::traverse::operator()(Algo, Value) [with Algo = int; Value = int]': main.cpp:16:37: required from here main.cpp:12:53: error: use of 'auto reflect::functors::recurse::operator()(int, int)' before deduction of 'auto' : recurse(0, 0)); ^ ' Internal compiler error: Error reporting routines re-entered. 0x641409 mark_used(tree_node*, int) ../../gcc/gcc/cp/decl2.c:5040 0x5da949 build_over_call ../../gcc/gcc/cp/call.c:7489 0x5e3e69 build_op_call_1 ../../gcc/gcc/cp/call.c:4335 0x5e3e69 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../gcc/gcc/cp/call.c:4358 0x6ad497 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../../gcc/gcc/cp/semantics.c:2424 0x60ddf5 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/gcc/cp/pt.c:15211 0x60ef45 tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/gcc/cp/pt.c:12530 0x646f4c dump_template_bindings ../../gcc/gcc/cp/error.c:369 0x646f4c dump_substitution ../../gcc/gcc/cp/error.c:1448 0x648da6 decl_to_string ../../gcc/gcc/cp/error.c:2910 0x648da6 cp_printer ../../gcc/gcc/cp/error.c:3494 0x108eb6b pp_format(pretty_printer*, text_info*) ../../gcc/gcc/pretty-print.c:613 0x108c5f8 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) ../../gcc/gcc/diagnostic.c:865 0x108d1c2 error(char const*, ...) ../../gcc/gcc/diagnostic.c:1137 0x641409 mark_used(tree_node*, int) ../../gcc/gcc/cp/decl2.c:5040 0x5da949 build_over_call ../../gcc/gcc/cp/call.c:7489 0x5e3e69 build_op_call_1 ../../gcc/gcc/cp/call.c:4335 0x5e3e69 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../gcc/gcc/cp/call.c:4358 0x6ad497 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../../gcc/gcc/cp/semantics.c:2424 0x66046a cp_parser_postfix_expression ../../gcc/gcc/cp/parser.c:6375 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.