diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/lookup/using9.C')
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/using9.C | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/lookup/using9.C b/gcc/testsuite/g++.dg/lookup/using9.C new file mode 100644 index 000000000..32abb5371 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/using9.C @@ -0,0 +1,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" } +} |