summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/lookup/using9.C
blob: 32abb5371f280c1f99373e41ffe0a2296abdb188 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// { dg-do compile }
// Origin: C++ Standard Draft (7.3.3/12)
// PR c++/2294: using declarations should not conflict, but only cause
//  an ambiguous overload set to be created.

namespace B {
  void f(int);     // { dg-message "note" }
  void f(double);  // { dg-message "note" }
}

namespace C {
  void f(int);     // { dg-message "note" }
  void f(double);  // { dg-message "note" }
  void f(char);    // { dg-message "note" }
}

void h()
{
  using B::f;
  using C::f;
  f('h');
  f(1);         // { dg-error "ambiguous" }
  // { dg-message "candidate" "candidate note" { target *-*-* } 22 }
  void f(int);  // { dg-error "previous using declaration" }
}

void m()
{
  void f(int);
  using B::f;   // { dg-error "already declared" }
}