https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85545
Bug ID: 85545 Summary: [8/9 Regression] ICE with static_cast of pointer-to-member-function Product: gcc Version: 8.0.1 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org CC: jakub at gcc dot gnu.org, rguenth at gcc dot gnu.org Target Milestone: --- The following valid code snippet (compiled with "-std=c++17 -Wformat" or "-std=c++17 -Wall") triggers an ICE with the GCC 8 release candidate and on trunk: ============================================== struct A { void foo() noexcept; }; template<typename T> void bar(T); void baz() { bar(static_cast<void(A::*)()>(&A::foo)); } ============================================== bug.cc: In function 'void baz()': bug.cc:10:41: internal compiler error: in fold_convert_loc, at fold-const.c:2524 bar(static_cast<void(A::*)()>(&A::foo)); ^ 0x6c4cf4 fold_convert_loc(unsigned int, tree_node*, tree_node*) ../../gcc/gcc/fold-const.c:2524 0x87539c cp_fold_convert(tree_node*, tree_node*) ../../gcc/gcc/cp/cvt.c:612 0x859760 cxx_eval_constant_expression ../../gcc/gcc/cp/constexpr.c:4613 0x85d0b7 cxx_eval_outermost_constant_expr ../../gcc/gcc/cp/constexpr.c:4861 0x85fed6 maybe_constant_value(tree_node*, tree_node*) ../../gcc/gcc/cp/constexpr.c:5079 0x821a5b build_over_call ../../gcc/gcc/cp/call.c:8078 0x82f1bf build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../gcc/gcc/cp/call.c:4319 0x9ade95 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../../gcc/gcc/cp/semantics.c:2534 0x938e2a cp_parser_postfix_expression ../../gcc/gcc/cp/parser.c:7235 0x939681 cp_parser_unary_expression ../../gcc/gcc/cp/parser.c:8317 0x9194ef cp_parser_cast_expression ../../gcc/gcc/cp/parser.c:9085 0x919cfa cp_parser_binary_expression ../../gcc/gcc/cp/parser.c:9186 0x91b534 cp_parser_assignment_expression ../../gcc/gcc/cp/parser.c:9481 0x91bc38 cp_parser_expression ../../gcc/gcc/cp/parser.c:9650 0x91d918 cp_parser_expression_statement ../../gcc/gcc/cp/parser.c:11132 0x923d4d cp_parser_statement ../../gcc/gcc/cp/parser.c:10936 0x9252c0 cp_parser_statement_seq_opt ../../gcc/gcc/cp/parser.c:11275 0x925397 cp_parser_compound_statement ../../gcc/gcc/cp/parser.c:11229 0x93bfa0 cp_parser_function_body ../../gcc/gcc/cp/parser.c:21802 0x93bfa0 cp_parser_ctor_initializer_opt_and_function_body ../../gcc/gcc/cp/parser.c:21839 Please submit a full bug report, [etc.] This is a very recent regression, introduced between 2018-04-22 and the release candidate. Jakub, I think this is related to your commit, r259629. I also think that this might qualify as release blocker.