The following testcases cause ICEs on mainline: g++.old-deja/g++.bugs/900213_03.C g++.old-deja/g++.other/pmf2.C g++.old-deja/g++.other/pmf7.C They all crash at the same position: pmf2.C: In function 'void f()': pmf2.C:17: error: ISO C++ forbids taking the address of a bound member function to form a pointer to member function. Say '&S::f' pmf2.C:17: internal compiler error: in build_offset_ref, at cp/init.c:1353 Please submit a full bug report, [etc.]
Grrr. Well confirmed. The reason why this does show up in the testresults is because of the follow: fmp = &ptr->function_member; // { dg-error "" } pmf = & pf->f; // { dg-error "" } not a valid pmf expression &a.f; // { dg-error "" } overloaded Meaning dg-error should really take an argument instead of just a null string.
So who ever fixes this bug, please also fix the testsuite so the testsuite will show the ICE.
The following code should compile with -fpermissive or -fms-extensions. So changing to ice-on-valid-code. ====================================== struct A { void foo(); }; void bar() { &A().foo; } ======================================
This patch fixes the ICE for me but I don't know if it is the correct one: Index: cp/typeck.c =================================================================== --- cp/typeck.c (revision 113199) +++ cp/typeck.c (working copy) @@ -4208,6 +4208,7 @@ build_unary_op (enum tree_code code, tre and the created OFFSET_REF. */ tree base = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (arg, 0))); tree fn = get_first_fn (TREE_OPERAND (arg, 1)); + mark_used (fn); if (! flag_ms_extensions) {
Mine.
Subject: Bug number PR C++/26740 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-05/msg01042.html
Subject: Bug 26740 Author: pinskia Date: Sun Jun 4 17:40:51 2006 New Revision: 114360 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114360 Log: 2006-06-01 Andrew Pinski <pinskia@physics.uc.edu> PR c++/26740 * typeck.c (build_unary_op): Mark the function as being used. Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/typeck.c
Fixed.