re PR c++/51565 (fastcall in array of method pointers: internal compiler error)
authorJason Merrill <jason@redhat.com>
Thu, 12 Jan 2012 02:30:47 +0000 (21:30 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 12 Jan 2012 02:30:47 +0000 (21:30 -0500)
PR c++/51565
* call.c (standard_conversion): For ptrmemfuncs, compare the
static_fn_types.

From-SVN: r183120

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/attrib42.C [new file with mode: 0644]

index 6850778b4d32587f2ec08f21b9e6683c429336e7..b11d6bf2448c7ef908e0678001844f78bd645525 100644 (file)
@@ -1,5 +1,9 @@
 2012-01-11  Jason Merrill  <jason@redhat.com>
 
+       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.
index 57b1765271a04f9d1bb346573825b90770924935..f7cfbd06616be5cc5c4b169952d7f03e2c0f37bf 100644 (file)
@@ -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));
index 970e4e0029247d6a28fc25918d87fa6ef3ff8a24..29c31f06d62215722020a80d95bf33b1a3bc2d87 100644 (file)
@@ -1,3 +1,8 @@
+2012-01-11  Jason Merrill  <jason@redhat.com>
+
+       PR c++/51565
+       * g++.dg/ext/attrib42.C: New.
+
 2012-01-11  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..39b8e22
--- /dev/null
@@ -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" }
+}