Commit 4cdeb234 by Jason Merrill Committed by Jason Merrill

Core issues 2273 and 2277

	* call.c (joust): Adjust using-declaration tiebreaker to handle
	the intermediate base case.
	* method.c (strip_inheriting_ctors): Just return the argument if
	!flag_new_inheriting_ctors.

From-SVN: r245892
parent ea6c757a
2017-03-03 Jason Merrill <jason@redhat.com>
Core issues 2273 and 2277
* call.c (joust): Adjust using-declaration tiebreaker to handle
the intermediate base case.
* method.c (strip_inheriting_ctors): Just return the argument if
!flag_new_inheriting_ctors.
2017-03-03 Richard Biener <rguenther@suse.de> 2017-03-03 Richard Biener <rguenther@suse.de>
PR c++/79825 PR c++/79825
......
...@@ -9735,20 +9735,26 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn, ...@@ -9735,20 +9735,26 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn,
} }
} }
/* or, if not that, F2 is from a using-declaration, F1 is not, and the /* F1 is a member of a class D, F2 is a member of a base class B of D, and
conversion sequences are equivalent. for all arguments the corresponding parameters of F1 and F2 have the same
(proposed in http://lists.isocpp.org/core/2016/10/1142.php) */ type (CWG 2273/2277). */
if (DECL_P (cand1->fn) && DECL_CLASS_SCOPE_P (cand1->fn) if (DECL_P (cand1->fn) && DECL_CLASS_SCOPE_P (cand1->fn)
&& !DECL_CONV_FN_P (cand1->fn) && !DECL_CONV_FN_P (cand1->fn)
&& DECL_P (cand2->fn) && DECL_CLASS_SCOPE_P (cand2->fn) && DECL_P (cand2->fn) && DECL_CLASS_SCOPE_P (cand2->fn)
&& !DECL_CONV_FN_P (cand2->fn)) && !DECL_CONV_FN_P (cand2->fn))
{ {
bool used1 = (DECL_INHERITED_CTOR (cand1->fn) tree base1 = DECL_CONTEXT (strip_inheriting_ctors (cand1->fn));
|| (BINFO_TYPE (cand1->access_path) tree base2 = DECL_CONTEXT (strip_inheriting_ctors (cand2->fn));
!= DECL_CONTEXT (cand1->fn)));
bool used2 = (DECL_INHERITED_CTOR (cand2->fn) bool used1 = false;
|| (BINFO_TYPE (cand2->access_path) bool used2 = false;
!= DECL_CONTEXT (cand2->fn))); if (base1 == base2)
/* No difference. */;
else if (DERIVED_FROM_P (base1, base2))
used1 = true;
else if (DERIVED_FROM_P (base2, base1))
used2 = true;
if (int diff = used2 - used1) if (int diff = used2 - used1)
{ {
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
......
...@@ -498,7 +498,8 @@ forward_parm (tree parm) ...@@ -498,7 +498,8 @@ forward_parm (tree parm)
tree tree
strip_inheriting_ctors (tree dfn) strip_inheriting_ctors (tree dfn)
{ {
gcc_assert (flag_new_inheriting_ctors); if (!flag_new_inheriting_ctors)
return dfn;
tree fn = dfn; tree fn = dfn;
while (tree inh = DECL_INHERITED_CTOR (fn)) while (tree inh = DECL_INHERITED_CTOR (fn))
{ {
......
// Core issues 2273, 2277
// { dg-do compile { target c++11 } }
struct A
{
A(int, int = 0);
static void f(int = 0);
};
struct B: A
{
using A::A;
B(int);
using A::f;
static void f();
};
struct C: B {
using B::B;
using B::f;
};
int main()
{
C c (42);
c.f();
}
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