Hi! This testcase regressed recently when Paolo added the user friendlier invalid use of member function vs. invalid use of member distinction, when TREE_OPERAND (value, 1) is BASELINK, DECL_FUNCTION_MEMBER_P on it dies with a checking ICE. The following patch calls get_first_fn if it is overloaded_fn.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2011-12-07 Jakub Jelinek <ja...@redhat.com> PR c++/51429 * typeck2.c (cxx_incomplete_type_diagnostic): Don't ICE if TREE_OPERAND (value, 1) is overloaded. * g++.dg/parse/error45.C: New test. --- gcc/cp/typeck2.c.jj 2011-11-07 12:40:45.000000000 +0100 +++ gcc/cp/typeck2.c 2011-12-07 15:31:30.506795286 +0100 @@ -428,15 +428,20 @@ cxx_incomplete_type_diagnostic (const_tr case OFFSET_TYPE: bad_member: - if (DECL_FUNCTION_MEMBER_P (TREE_OPERAND (value, 1)) - && ! flag_ms_extensions) - emit_diagnostic (diag_kind, input_location, 0, - "invalid use of member function " - "(did you forget the %<()%> ?)"); - else - emit_diagnostic (diag_kind, input_location, 0, - "invalid use of member " - "(did you forget the %<&%> ?)"); + { + tree member = TREE_OPERAND (value, 1); + if (is_overloaded_fn (member)) + member = get_first_fn (member); + if (DECL_FUNCTION_MEMBER_P (member) + && ! flag_ms_extensions) + emit_diagnostic (diag_kind, input_location, 0, + "invalid use of member function " + "(did you forget the %<()%> ?)"); + else + emit_diagnostic (diag_kind, input_location, 0, + "invalid use of member " + "(did you forget the %<&%> ?)"); + } break; case TEMPLATE_TYPE_PARM: --- gcc/testsuite/g++.dg/parse/error45.C.jj 2011-12-07 15:45:28.732286838 +0100 +++ gcc/testsuite/g++.dg/parse/error45.C 2011-12-07 15:44:20.000000000 +0100 @@ -0,0 +1,9 @@ +// PR c++/51429 +// { dg-do compile } + +struct A +{ + void foo (double); + void foo (int); + A () { foo = 0; } // { dg-error "invalid use of member function" } +}; Jakub