fork download
  1. unsigned constexpr foo(int (*p)[1]) { return 0ULL; }
  2. int constexpr foo(void* p) { return 0; }
  3.  
  4. template<int N> auto const bar = foo((int(*)[N])nullptr);
  5. template<int N> int const buz = (true ? -1 : bar<N>) / 2;
  6.  
  7. int main() {
  8. // auto x = bar<1>; // uncomment to eliminate ICE
  9. auto y = buz<1>; // ICE!!!
  10. }
  11.  
Compilation error #stdin compilation error #stdout 0s 3452KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of 'const int buz<1>':
prog.cpp:9:14:   required from here
prog.cpp:4:28: internal compiler error: in tsubst, at cp/pt.c:12126
 template<int N> auto const bar = foo((int(*)[N])nullptr);
                            ^
0x821bd70 tsubst(tree_node*, tree_node*, int, tree_node*)
	../../src/gcc/cp/pt.c:12126
0x822793a tsubst_decl
	../../src/gcc/cp/pt.c:11441
0x821b2be tsubst(tree_node*, tree_node*, int, tree_node*)
	../../src/gcc/cp/pt.c:11934
0x8225b04 tsubst_copy
	../../src/gcc/cp/pt.c:13081
0x8217f03 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
	../../src/gcc/cp/pt.c:15705
0x8219e48 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
	../../src/gcc/cp/pt.c:15369
0x8218ac1 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
	../../src/gcc/cp/pt.c:14895
0x821fde7 tsubst_expr
	../../src/gcc/cp/pt.c:14530
0x821de87 regenerate_decl_from_template
	../../src/gcc/cp/pt.c:20022
0x821de87 instantiate_decl(tree_node*, int, bool)
	../../src/gcc/cp/pt.c:20434
0x824c1a3 mark_used(tree_node*, int)
	../../src/gcc/cp/decl2.c:5032
0x824c53d mark_used(tree_node*)
	../../src/gcc/cp/decl2.c:5146
0x82b2e24 finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*, bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int)
	../../src/gcc/cp/semantics.c:3582
0x8267a2f cp_parser_primary_expression
	../../src/gcc/cp/parser.c:4763
0x8268ab4 cp_parser_postfix_expression
	../../src/gcc/cp/parser.c:6157
0x826acf0 cp_parser_unary_expression
	../../src/gcc/cp/parser.c:7438
0x826b7f4 cp_parser_binary_expression
	../../src/gcc/cp/parser.c:8172
0x826bdbb cp_parser_assignment_expression
	../../src/gcc/cp/parser.c:8430
0x826c1f7 cp_parser_constant_expression
	../../src/gcc/cp/parser.c:8676
0x8279d76 cp_parser_init_declarator
	../../src/gcc/cp/parser.c:17270
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
stdout
Standard output is empty