* class.c (add_method): Allow using-declarations to coexist.
From-SVN: r241620
This commit is contained in:
parent
104700f4e9
commit
7c92f4ec61
3 changed files with 28 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
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>
|
||||
|
||||
* constexpr.c (maybe_constant_init): Pull out TARGET_EXPR_INITIAL.
|
||||
|
|
|
@ -1094,6 +1094,11 @@ add_method (tree type, tree method, tree using_decl)
|
|||
if (TREE_CODE (fn) != TREE_CODE (method))
|
||||
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
|
||||
same name and the same parameter types cannot be
|
||||
overloaded if any of them is a static member
|
||||
|
|
19
gcc/testsuite/g++.dg/overload/using4.C
Normal file
19
gcc/testsuite/g++.dg/overload/using4.C
Normal file
|
@ -0,0 +1,19 @@
|
|||
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" }
|
||||
}
|
Loading…
Add table
Reference in a new issue