Commit 51543dc7 by Jason Merrill Committed by Jason Merrill

re PR c++/57254 (Overload resolution failure when ref-qualified member function…

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
parent 18dc5657
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.
......
......@@ -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;
}
......
// 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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment