Commit 7c92f4ec by Jason Merrill Committed by Jason Merrill

* class.c (add_method): Allow using-declarations to coexist.

From-SVN: r241620
parent 104700f4
2016-10-26 Jason Merrill <jason@redhat.com>
* class.c (add_method): Allow using-declarations to coexist.
2016-10-25 Jason Merrill <jason@redhat.com> 2016-10-25 Jason Merrill <jason@redhat.com>
* constexpr.c (maybe_constant_init): Pull out TARGET_EXPR_INITIAL. * constexpr.c (maybe_constant_init): Pull out TARGET_EXPR_INITIAL.
......
...@@ -1094,6 +1094,11 @@ add_method (tree type, tree method, tree using_decl) ...@@ -1094,6 +1094,11 @@ add_method (tree type, tree method, tree using_decl)
if (TREE_CODE (fn) != TREE_CODE (method)) if (TREE_CODE (fn) != TREE_CODE (method))
continue; continue;
/* Two using-declarations can coexist, we'll complain about ambiguity in
overload resolution. */
if (using_decl && TREE_CODE (fns) == OVERLOAD && OVL_USED (fns))
continue;
/* [over.load] Member function declarations with the /* [over.load] Member function declarations with the
same name and the same parameter types cannot be same name and the same parameter types cannot be
overloaded if any of them is a static member overloaded if any of them is a static member
......
struct A
{
void f();
};
struct B
{
void f();
};
struct C: A,B {
using A::f;
using B::f;
};
int main()
{
C().f(); // { dg-error "ambiguous" }
}
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