[Bug c++/55580] internal compiler error: Segmentation fault - with variadic template parameter
vlukas at gmx dot de
gcc-bugzilla@gcc.gnu.org
Mon Dec 3 22:42:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55580
--- Comment #1 from vlukas at gmx dot de 2012-12-03 22:42:06 UTC ---
I believe the following reduced snippet reproduces the original crash:
-------------------------------------------------------------------
template<int> struct V { };
template<typename...> struct F { };
template<typename... Ps>
template<int I>
struct F<V<I>, Ps...>
{ };
F<V<0>> x;
--------------------------------------------------------------------
With gcc version 4.8.0 20121122 (experimental) (GCC) I get the following:
--------------------------------------------------------------------
55580.cc:10:9: internal compiler error: tree check: expected class
'expression', have 'constant' (integer_cst) in tree_operand_check, at
tree.h:4113
F<V<0>> x;
^
0xc8eb59 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
../../gcc_svn/gcc/tree.c:9006
0x4e32ed expr_check
../../gcc_svn/gcc/tree.h:3849
0x4e32ed tree_operand_check
../../gcc_svn/gcc/tree.h:4113
0x5af3f5 tree_operand_check
../../gcc_svn/gcc/tree.h:3870
0x5af3f5 unify_pack_expansion
../../gcc_svn/gcc/cp/pt.c:16058
0x5b385f unify
../../gcc_svn/gcc/cp/pt.c:16737
0x5b19cf unify
../../gcc_svn/gcc/cp/pt.c:16579
0x5b22ac unify
../../gcc_svn/gcc/cp/pt.c:16729
0x5b49fe get_class_bindings
../../gcc_svn/gcc/cp/pt.c:17439
0x5b566c most_specialized_class
../../gcc_svn/gcc/cp/pt.c:17688
0x5c2840 instantiate_class_template_1
../../gcc_svn/gcc/cp/pt.c:8514
0x5c2840 instantiate_class_template(tree_node*)
../../gcc_svn/gcc/cp/pt.c:9019
0x64d83b complete_type(tree_node*)
../../gcc_svn/gcc/cp/typeck.c:134
0x54c385 start_decl_1(tree_node*, bool)
../../gcc_svn/gcc/cp/decl.c:4665
0x56bd42 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
../../gcc_svn/gcc/cp/decl.c:4628
0x63a538 cp_parser_init_declarator
../../gcc_svn/gcc/cp/parser.c:15882
0x63aede cp_parser_simple_declaration
../../gcc_svn/gcc/cp/parser.c:10546
0x63cd87 cp_parser_block_declaration
../../gcc_svn/gcc/cp/parser.c:10427
0x645c0b cp_parser_declaration
../../gcc_svn/gcc/cp/parser.c:10324
0x64483d cp_parser_declaration_seq_opt
../../gcc_svn/gcc/cp/parser.c:10210
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.
------------------------------------------------------------------------------
The backtrace I get from the original testcase is slightly different, but the
toplevel is the same ("internal compiler error: tree check: expected class
'expression', have 'constant' (integer_cst) in tree_operand_check, at
tree.h:4113").
I do not know whether the introduction of a second template parameter list for
the partial specialization is valid C++. It can be made to work by changing it
to:
------------------------------------------------
template< typename ... _Rest, int const _speed >
//template< int const _speed >
struct Features< ConstValue< _speed >, _Rest ... >
----------------------------------------------
I hope that helps.
More information about the Gcc-bugs
mailing list