PR c++/57254
* typeck.c (merge_types): Propagate ref-qualifier
in METHOD_TYPE case.
From-SVN: r198843
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.
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
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;
}
--- /dev/null
+// 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);
+}