From efcc9293a66671758a373804b60e7bb9517b8eac Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 11 Jan 2012 21:30:47 -0500 Subject: [PATCH] re PR c++/51565 (fastcall in array of method pointers: internal compiler error) PR c++/51565 * call.c (standard_conversion): For ptrmemfuncs, compare the static_fn_types. From-SVN: r183120 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/call.c | 6 ++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ext/attrib42.C | 12 ++++++++++++ 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/attrib42.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6850778b4d3..b11d6bf2448 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2012-01-11 Jason Merrill + PR c++/51565 + * call.c (standard_conversion): For ptrmemfuncs, compare the + static_fn_types. + PR c++/51818 * mangle.c (find_substitution): A type is only a substitution match if we're looking for a type. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 57b1765271a..f7cfbd06616 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -1274,10 +1274,8 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p, tree tbase = class_of_this_parm (tofn); if (!DERIVED_FROM_P (fbase, tbase) - || !same_type_p (TREE_TYPE (fromfn), TREE_TYPE (tofn)) - || !compparms (TREE_CHAIN (TYPE_ARG_TYPES (fromfn)), - TREE_CHAIN (TYPE_ARG_TYPES (tofn))) - || cp_type_quals (fbase) != cp_type_quals (tbase)) + || !same_type_p (static_fn_type (fromfn), + static_fn_type (tofn))) return NULL; from = build_memfn_type (fromfn, tbase, cp_type_quals (tbase)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 970e4e00292..29c31f06d62 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-01-11 Jason Merrill + + PR c++/51565 + * g++.dg/ext/attrib42.C: New. + 2012-01-11 Jakub Jelinek PR bootstrap/51796 diff --git a/gcc/testsuite/g++.dg/ext/attrib42.C b/gcc/testsuite/g++.dg/ext/attrib42.C new file mode 100644 index 00000000000..39b8e22099c --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib42.C @@ -0,0 +1,12 @@ +// { dg-do compile { target i?86-*-* } } + +struct A { + __attribute__((fastcall)) + void f(); +}; + +int main() +{ + typedef void (A::*FP)(); + FP fp[] = {&A::f}; // { dg-error "cannot convert" } +} -- 2.30.2