c++: CWG2235 partial ordering and non-dependent types
Issue 2235 removed the rule previously added for issues 1391/1847 that had partial ordering completely ignore function parameters with no deducible template parameters. gcc/cp/ChangeLog 2020-05-05 Jason Merrill <jason@redhat.com> CWG 2235 * pt.c (more_specialized_fn): Do consider parms with no deducible template parameters.
This commit is contained in:
parent
04b89192ac
commit
e42f342652
@ -1,3 +1,9 @@
|
|||||||
|
2020-05-05 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
CWG 2235
|
||||||
|
* pt.c (more_specialized_fn): Do consider parms with no deducible
|
||||||
|
template parameters.
|
||||||
|
|
||||||
2020-05-05 Jason Merrill <jason@redhat.com>
|
2020-05-05 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
PR c++/90212
|
PR c++/90212
|
||||||
|
@ -23960,13 +23960,6 @@ more_specialized_fn (tree pat1, tree pat2, int len)
|
|||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DR 1847: If a particular P contains no template-parameters that
|
|
||||||
participate in template argument deduction, that P is not used to
|
|
||||||
determine the ordering. */
|
|
||||||
if (!uses_deducible_template_parms (arg1)
|
|
||||||
&& !uses_deducible_template_parms (arg2))
|
|
||||||
goto next;
|
|
||||||
|
|
||||||
if (TYPE_REF_P (arg1))
|
if (TYPE_REF_P (arg1))
|
||||||
{
|
{
|
||||||
ref1 = TYPE_REF_IS_RVALUE (arg1) + 1;
|
ref1 = TYPE_REF_IS_RVALUE (arg1) + 1;
|
||||||
@ -24088,8 +24081,6 @@ more_specialized_fn (tree pat1, tree pat2, int len)
|
|||||||
These must be unordered. */
|
These must be unordered. */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
next:
|
|
||||||
|
|
||||||
if (TREE_CODE (arg1) == TYPE_PACK_EXPANSION
|
if (TREE_CODE (arg1) == TYPE_PACK_EXPANSION
|
||||||
|| TREE_CODE (arg2) == TYPE_PACK_EXPANSION)
|
|| TREE_CODE (arg2) == TYPE_PACK_EXPANSION)
|
||||||
/* We have already processed all of the arguments in our
|
/* We have already processed all of the arguments in our
|
||||||
|
@ -14,5 +14,5 @@ void f(typename A<T>::size_type, T);
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
f(1,2); // { dg-error "ambiguous" }
|
f(1,2);
|
||||||
}
|
}
|
||||||
|
20
gcc/testsuite/g++.dg/template/partial-order2.C
Normal file
20
gcc/testsuite/g++.dg/template/partial-order2.C
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// CWG 2235
|
||||||
|
|
||||||
|
namespace X
|
||||||
|
{
|
||||||
|
template<typename T> struct Const { typedef void type; };
|
||||||
|
template<typename T> void f(T, typename Const<T>::type*); // T1
|
||||||
|
template<typename T> void f(T, void *); // T2
|
||||||
|
void g(void *p) { f(0, p); }
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Y
|
||||||
|
{
|
||||||
|
struct A { A(int); };
|
||||||
|
struct B { B(int); };
|
||||||
|
|
||||||
|
template<typename T> void f(T, A);
|
||||||
|
template<typename T> void f(T*, B);
|
||||||
|
|
||||||
|
void g(int *p) { f(p, 0); } // { dg-error "ambiguous" }
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user