summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-13 19:32:28 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-13 19:32:28 +0000
commit14e29aaaa67c060071868ec763051f658773487a (patch)
tree58ac6c022ba0ed038ea1a380da669134f98c6e57 /gcc
parent34cd73ce1055f23c70ed57a80fabbe3fe5a770fc (diff)
downloadgcc-14e29aaaa67c060071868ec763051f658773487a.tar.gz
PR c++/57254
* typeck.c (merge_types): Propagate ref-qualifier in METHOD_TYPE case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198843 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/ref-qual12.C22
3 files changed, 28 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e1eda6a0fad..6c5d210601e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2013-05-13 Jason Merrill <jason@redhat.com>
+ PR c++/57254
+ * typeck.c (merge_types): Propagate ref-qualifier
+ in METHOD_TYPE case.
+
PR c++/57253
* decl.c (grokdeclarator): Apply ref-qualifier
in the TYPENAME case.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index b8ea5551353..fb758474a45 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -851,6 +851,7 @@ merge_types (tree t1, tree t2)
tree raises = merge_exception_specifiers (TYPE_RAISES_EXCEPTIONS (t1),
TYPE_RAISES_EXCEPTIONS (t2),
NULL_TREE);
+ cp_ref_qualifier rqual = type_memfn_rqual (t1);
tree t3;
/* If this was a member function type, get back to the
@@ -864,6 +865,7 @@ merge_types (tree t1, tree t2)
t3 = build_method_type_directly (basetype, TREE_TYPE (t3),
TYPE_ARG_TYPES (t3));
t1 = build_exception_variant (t3, raises);
+ t1 = build_ref_qualified_type (t1, rqual);
break;
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/ref-qual12.C b/gcc/testsuite/g++.dg/cpp0x/ref-qual12.C
new file mode 100644
index 00000000000..b0a16fe9435
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/ref-qual12.C
@@ -0,0 +1,22 @@
+// PR c++/57254
+// { dg-require-effective-target c++11 }
+
+struct foo {
+ template<typename T>
+ void bar(T) &;
+
+ template<typename T>
+ void bar(T) &&;
+};
+
+template<typename T>
+void foo::bar(T) & {}
+
+template<typename T>
+void foo::bar(T) && {}
+
+int main()
+{
+ foo f;
+ f.bar(0);
+}