PR c++/57252
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 13 May 2013 19:32:15 +0000 (19:32 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 13 May 2013 19:32:15 +0000 (19:32 +0000)
* decl.c (decls_match): Compare ref-qualifiers.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198841 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.dg/cpp0x/ref-qual10.C [new file with mode: 0644]

index 67b4d77..eab529a 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-13  Jason Merrill  <jason@redhat.com>
+
+       PR c++/57252
+       * decl.c (decls_match): Compare ref-qualifiers.
+
 2013-05-10  Jason Merrill  <jason@redhat.com>
 
        PR c++/57196
index 9c97c9d..0df3ae8 100644 (file)
@@ -1024,6 +1024,7 @@ decls_match (tree newdecl, tree olddecl)
          else
            types_match =
              compparms (p1, p2)
+             && type_memfn_rqual (f1) == type_memfn_rqual (f2)
              && (TYPE_ATTRIBUTES (TREE_TYPE (newdecl)) == NULL_TREE
                  || comp_type_attributes (TREE_TYPE (newdecl),
                                           TREE_TYPE (olddecl)) != 0);
diff --git a/gcc/testsuite/g++.dg/cpp0x/ref-qual10.C b/gcc/testsuite/g++.dg/cpp0x/ref-qual10.C
new file mode 100644 (file)
index 0000000..1b6c54f
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/57252
+// { dg-require-effective-target c++11 }
+
+struct foo {
+  void bar() & {}
+  void bar() && {}
+};
+
+int main()
+{
+  auto p = &foo::bar;          // { dg-error "" }
+  (foo{}.*p)();
+}