Commit 9ea97097 by Jason Merrill Committed by Jason Merrill

PR c++/71784 - ICE with ref-qualifier and explicit specialization.

	* pt.c (determine_specialization): Check ref-qualifier.

From-SVN: r258085
parent 74fc2a2b
2018-02-28 Jason Merrill <jason@redhat.com>
PR c++/71784 - ICE with ref-qualifier and explicit specialization.
* pt.c (determine_specialization): Check ref-qualifier.
2018-02-28 Jakub Jelinek <jakub@redhat.com> 2018-02-28 Jakub Jelinek <jakub@redhat.com>
PR c++/84609 PR c++/84609
......
...@@ -2163,10 +2163,17 @@ determine_specialization (tree template_id, ...@@ -2163,10 +2163,17 @@ determine_specialization (tree template_id,
that the const qualification is the same. Since that the const qualification is the same. Since
get_bindings does not try to merge the "this" parameter, get_bindings does not try to merge the "this" parameter,
we must do the comparison explicitly. */ we must do the comparison explicitly. */
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn) if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
&& !same_type_p (TREE_VALUE (fn_arg_types), {
TREE_VALUE (decl_arg_types))) if (!same_type_p (TREE_VALUE (fn_arg_types),
continue; TREE_VALUE (decl_arg_types)))
continue;
/* And the ref-qualification. */
if (type_memfn_rqual (TREE_TYPE (decl))
!= type_memfn_rqual (TREE_TYPE (fn)))
continue;
}
/* Skip the "this" parameter and, for constructors of /* Skip the "this" parameter and, for constructors of
classes with virtual bases, the VTT parameter. A classes with virtual bases, the VTT parameter. A
...@@ -2277,6 +2284,11 @@ determine_specialization (tree template_id, ...@@ -2277,6 +2284,11 @@ determine_specialization (tree template_id,
decl_arg_types)) decl_arg_types))
continue; continue;
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
&& (type_memfn_rqual (TREE_TYPE (decl))
!= type_memfn_rqual (TREE_TYPE (fn))))
continue;
// If the deduced arguments do not satisfy the constraints, // If the deduced arguments do not satisfy the constraints,
// this is not a candidate. // this is not a candidate.
if (flag_concepts && !constraints_satisfied_p (fn)) if (flag_concepts && !constraints_satisfied_p (fn))
......
// PR c++/71784
// { dg-do compile { target c++11 } }
template<typename T> struct A {
template<typename U> void f(U const&) & { }
template<typename U> void f(U const&) && { }
};
template void A<int>::f<int>(int const&) &;
template void A<float>::f<int>(int const&) &&;
template<typename T> struct B {
void f(int const&) & { }
void f(int const&) && { }
};
template void B<int>::f(int const&) &;
template void B<float>::f(int const&) &&;
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