aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-05-13 15:32:28 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-05-13 15:32:28 -0400
commit51543dc77b0a7c1e82cfb4c991dbfed7f0e1e4fd (patch)
tree58ac6c022ba0ed038ea1a380da669134f98c6e57 /gcc
parent18dc5657de4d850295c3c8662520b256b00ce1af (diff)
downloadgcc-51543dc77b0a7c1e82cfb4c991dbfed7f0e1e4fd.zip
gcc-51543dc77b0a7c1e82cfb4c991dbfed7f0e1e4fd.tar.gz
gcc-51543dc77b0a7c1e82cfb4c991dbfed7f0e1e4fd.tar.bz2
re PR c++/57254 (Overload resolution failure when ref-qualified member function templates are defined out-of-line)
PR c++/57254 * typeck.c (merge_types): Propagate ref-qualifier in METHOD_TYPE case. From-SVN: r198843
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 e1eda6a..6c5d210 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 b8ea555..fb75847 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 0000000..b0a16fe
--- /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);
+}