https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72801
Bug ID: 72801 Summary: ICE on invalid C++ code with ill-formed class member specialization: tree check: expected class ‘expression’, have ‘type’ (integer_type) in tree_operand_check, at tree.h:3521 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: --- This is a regression from 6.1.x. $ 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 20160802 (experimental) [trunk revision 238983] (GCC) $ $ g++-trunk -c small.cpp small.cpp:17:50: internal compiler error: tree check: expected class ‘expression’, have ‘type’ (integer_type) in tree_operand_check, at tree.h:3521 template <> const int B <>::template C < int () >::a; ^~ 0x1071a07 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc-source-trunk/gcc/tree.c:9793 0x5da8f1 expr_check ../../gcc-source-trunk/gcc/tree.h:3192 0x5da8f1 tree_operand_check ../../gcc-source-trunk/gcc/tree.h:3521 0x709be5 tree_operand_check ../../gcc-source-trunk/gcc/tree.h:3244 0x709be5 unify_pack_expansion ../../gcc-source-trunk/gcc/cp/pt.c:19337 0x70a7b9 type_unification_real ../../gcc-source-trunk/gcc/cp/pt.c:18481 0x70c2fe unify ../../gcc-source-trunk/gcc/cp/pt.c:20176 0x70c516 unify ../../gcc-source-trunk/gcc/cp/pt.c:20056 0x70ed47 get_partial_spec_bindings ../../gcc-source-trunk/gcc/cp/pt.c:20826 0x7066c6 most_specialized_partial_spec ../../gcc-source-trunk/gcc/cp/pt.c:21082 0x721993 instantiate_class_template_1 ../../gcc-source-trunk/gcc/cp/pt.c:9847 0x721993 instantiate_class_template(tree_node*) ../../gcc-source-trunk/gcc/cp/pt.c:10412 0x7c7363 complete_type(tree_node*) ../../gcc-source-trunk/gcc/cp/typeck.c:133 0x79954c cp_parser_nested_name_specifier_opt ../../gcc-source-trunk/gcc/cp/parser.c:6131 0x79a05e cp_parser_nested_name_specifier ../../gcc-source-trunk/gcc/cp/parser.c:6194 0x7a7cf6 cp_parser_ptr_operator ../../gcc-source-trunk/gcc/cp/parser.c:19525 0x79e67b cp_parser_declarator ../../gcc-source-trunk/gcc/cp/parser.c:18841 0x7b38b5 cp_parser_init_declarator ../../gcc-source-trunk/gcc/cp/parser.c:18424 0x7b57d1 cp_parser_single_declaration ../../gcc-source-trunk/gcc/cp/parser.c:25938 0x7b65e3 cp_parser_explicit_specialization ../../gcc-source-trunk/gcc/cp/parser.c:15779 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. $ ------------------------------------------------------- template < typename, typename > struct A {}; template < typename ... T > struct B { template < typename > struct C { static const int a = 0; }; template < typename R, typename ... S > struct C < R (A < T, S > ...) > { static const int a = 1; }; }; template <> const int B <>::template C < int () >::a;