https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78649
Bug ID: 78649 Summary: ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in build_value_init_noctor, at cp/init.c:380) Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com Target Milestone: --- $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-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 20161202 (experimental) [trunk revision 243153] (GCC) $ $ gcc-trunk small.C small.C: In instantiation of ‘void test() [with T = void; Args = {}]’: small.C:4:24: required from here small.C:2:51: error: variable or field ‘t’ declared void template <class T, class... Args> void test() { T t(create<Args>...); } ^ small.C:2:51: internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in build_value_init_noctor, at cp/init.c:380 0x10a1c87 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc-source-trunk/gcc/tree.c:9865 0x80db2b tree_class_check ../../gcc-source-trunk/gcc/tree.h:3169 0x80db2b build_value_init_noctor(tree_node*, int) ../../gcc-source-trunk/gcc/cp/init.c:380 0x80dbbd build_value_init(tree_node*, int) ../../gcc-source-trunk/gcc/cp/init.c:369 0x5e31a2 tsubst_init ../../gcc-source-trunk/gcc/cp/pt.c:14095 0x6fb2aa tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc-source-trunk/gcc/cp/pt.c:15500 0x6f79f3 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc-source-trunk/gcc/cp/pt.c:15618 0x6f50ce instantiate_decl(tree_node*, int, bool) ../../gcc-source-trunk/gcc/cp/pt.c:22536 0x7373f2 instantiate_pending_templates(int) ../../gcc-source-trunk/gcc/cp/pt.c:22655 0x77e8b1 c_parse_final_cleanups() ../../gcc-source-trunk/gcc/cp/decl2.c:4512 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. $ $ cat small.C template <class> void create(); template <class T, class... Args> void test() { T t(create<Args>...); } int main() { test<void>; } $