https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77852
Bug ID: 77852
Summary: ICE when deducing class template arguments for pair or
tuple
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ville.voutilainen at gmail dot com
Target Milestone: ---
First test:
#include <utility>
int main()
{
std::pair x{42, 666};
}
Second test:
#include <tuple>
int main()
{
std::tuple y{1,2,3};
}
ICE for the first:
c-a-d.cpp: In function ‘int main()’:
c-a-d.cpp:5:21: error: direct-list-initialization of ‘auto’ requires exactly
one element [-fpermissive]
std::pair x{42, 666};
^
c-a-d.cpp:5:21: note: for deduction to ‘std::initializer_list’, use
copy-list-initialization (i.e. add ‘=’ before the ‘{’)
c-a-d.cpp:5:21: internal compiler error: same canonical type node for different
types _Tp and pair
0x781f7b comptypes(tree_node*, tree_node*, int)
../../gcc/cp/typeck.c:1436
0x67fb58 template_args_equal(tree_node*, tree_node*)
../../gcc/cp/pt.c:7918
0x67f83f comp_template_args(tree_node*, tree_node*, tree_node**, tree_node**)
../../gcc/cp/pt.c:7965
0x68f2f6 spec_hasher::equal(spec_entry*, spec_entry*)
../../gcc/cp/pt.c:1652
0x6e2be5 hash_table<spec_hasher, xcallocator>::find_with_hash(spec_entry*
const&, unsigned int)
../../gcc/hash-table.h:840
0x6ba9c2 lookup_template_class_1
../../gcc/cp/pt.c:8355
0x6ba9c2 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc/cp/pt.c:8670
0x6d5f6e listify_autos
../../gcc/cp/pt.c:24023
0x6d88eb do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context)
../../gcc/cp/pt.c:24488
0x66f92f cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../../gcc/cp/decl.c:6706
0x76aeec cp_parser_init_declarator
../../gcc/cp/parser.c:18987
0x76b594 cp_parser_simple_declaration
../../gcc/cp/parser.c:12566
0x76b935 cp_parser_block_declaration
../../gcc/cp/parser.c:12442
0x76c3e9 cp_parser_declaration_statement
../../gcc/cp/parser.c:12051
0x74ae43 cp_parser_statement
../../gcc/cp/parser.c:10603
0x74bdbd cp_parser_statement_seq_opt
../../gcc/cp/parser.c:10935
0x74be9f cp_parser_compound_statement
../../gcc/cp/parser.c:10889
0x7698a3 cp_parser_function_body
../../gcc/cp/parser.c:20997
0x7698a3 cp_parser_ctor_initializer_opt_and_function_body
../../gcc/cp/parser.c:21033
0x76a2e1 cp_parser_function_definition_after_declarator
../../gcc/cp/parser.c:25785
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.
ICE for the second:
c-a-d_2.cpp: In function ‘int main()’:
c-a-d_2.cpp:5:20: error: direct-list-initialization of ‘auto’ requires exactly
one element [-fpermissive]
std::tuple y{1,2,3};
^
c-a-d_2.cpp:5:20: note: for deduction to ‘std::initializer_list’, use
copy-list-initialization (i.e. add ‘=’ before the ‘{’)
c-a-d_2.cpp:5:20: internal compiler error: same canonical type node for
different types _Tp and tuple
0x781f7b comptypes(tree_node*, tree_node*, int)
../../gcc/cp/typeck.c:1436
0x67fb58 template_args_equal(tree_node*, tree_node*)
../../gcc/cp/pt.c:7918
0x67f83f comp_template_args(tree_node*, tree_node*, tree_node**, tree_node**)
../../gcc/cp/pt.c:7965
0x68f2f6 spec_hasher::equal(spec_entry*, spec_entry*)
../../gcc/cp/pt.c:1652
0x6e2b52 hash_table<spec_hasher, xcallocator>::find_with_hash(spec_entry*
const&, unsigned int)
../../gcc/hash-table.h:827
0x6ba9c2 lookup_template_class_1
../../gcc/cp/pt.c:8355
0x6ba9c2 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc/cp/pt.c:8670
0x6d5f6e listify_autos
../../gcc/cp/pt.c:24023
0x6d88eb do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context)
../../gcc/cp/pt.c:24488
0x66f92f cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../../gcc/cp/decl.c:6706
0x76aeec cp_parser_init_declarator
../../gcc/cp/parser.c:18987
0x76b594 cp_parser_simple_declaration
../../gcc/cp/parser.c:12566
0x76b935 cp_parser_block_declaration
../../gcc/cp/parser.c:12442
0x76c3e9 cp_parser_declaration_statement
../../gcc/cp/parser.c:12051
0x74ae43 cp_parser_statement
../../gcc/cp/parser.c:10603
0x74bdbd cp_parser_statement_seq_opt
../../gcc/cp/parser.c:10935
0x74be9f cp_parser_compound_statement
../../gcc/cp/parser.c:10889
0x7698a3 cp_parser_function_body
../../gcc/cp/parser.c:20997
0x7698a3 cp_parser_ctor_initializer_opt_and_function_body
../../gcc/cp/parser.c:21033
0x76a2e1 cp_parser_function_definition_after_declarator
../../gcc/cp/parser.c:25785
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.