http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59646
Bug ID: 59646 Summary: [4.7/4.8/4.9 Regression] ICE with volatile in initializer list Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org The following (invalid?) code snippet triggers an ICE since GCC 4.7.0: =========================================================== #include <initializer_list> struct A {}; std::initializer_list<volatile A> x = {{}}; =========================================================== bug.cc:5:42: error: no matching function for call to 'A::A(volatile A)' std::initializer_list<volatile A> x = {{}}; ^ bug.cc:5:42: note: candidates are: bug.cc:3:8: note: constexpr A::A() struct A {}; ^ bug.cc:3:8: note: candidate expects 0 arguments, 1 provided bug.cc:3:8: note: constexpr A::A(const A&) bug.cc:3:8: note: no known conversion for argument 1 from 'volatile A' to 'const A&' bug.cc:3:8: note: constexpr A::A(A&&) bug.cc:3:8: note: no known conversion for argument 1 from 'volatile A' to 'A&&' bug.cc: In function 'void __static_initialization_and_destruction_0(int, int)': bug.cc:5:42: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.c:80 std::initializer_list<volatile A> x = {{}}; ^ 0xd8f855 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc/gcc/tree.c:9243 0x9a5f05 tree_class_check ../../gcc/gcc/tree.h:2830 0x9a5f05 useless_type_conversion_p(tree_node*, tree_node*) ../../gcc/gcc/gimple-expr.c:80 0x9d2cf9 gimplify_modify_expr ../../gcc/gcc/gimplify.c:4446 0x9c72fc gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:7431 0x9cb7b6 gimplify_stmt(tree_node**, gimple_statement_base**) ../../gcc/gcc/gimplify.c:5334 0x9c74ec gimplify_cleanup_point_expr ../../gcc/gcc/gimplify.c:5110 0x9c74ec gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:7787 0x9cb7b6 gimplify_stmt(tree_node**, gimple_statement_base**) ../../gcc/gcc/gimplify.c:5334 0x9c7aab gimplify_statement_list ../../gcc/gcc/gimplify.c:1405 0x9c7aab gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:7839 0x9cb7b6 gimplify_stmt(tree_node**, gimple_statement_base**) ../../gcc/gcc/gimplify.c:5334 0x9cf6d3 gimplify_cond_expr ../../gcc/gcc/gimplify.c:3052 0x9c7333 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:7387 0x9cb7b6 gimplify_stmt(tree_node**, gimple_statement_base**) ../../gcc/gcc/gimplify.c:5334 0x9cf6d3 gimplify_cond_expr ../../gcc/gcc/gimplify.c:3052 0x9c7333 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:7387 0x9cb7b6 gimplify_stmt(tree_node**, gimple_statement_base**) ../../gcc/gcc/gimplify.c:5334 0x9ccf7a gimplify_body(tree_node*, bool) ../../gcc/gcc/gimplify.c:8531 0x9cd579 gimplify_function_tree(tree_node*) ../../gcc/gcc/gimplify.c:8684 Please submit a full bug report, [etc.] Btw, clang 3.2 accepts the above code snippet. Also the code is accepted if 'A' is replaced by 'int'.