re PR c++/2294 (using declaration confusion)
authorGiovanni Bajo <giovannibajo@libero.it>
Fri, 14 Nov 2003 20:41:04 +0000 (21:41 +0100)
committerBernardo Innocenti <bernie@gcc.gnu.org>
Fri, 14 Nov 2003 20:41:04 +0000 (21:41 +0100)
        PR c++/2294
        * g++.dg/lookup/using9.c: New test.

From-SVN: r73621

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/using9.C [new file with mode: 0644]

index 3e9f9fa..a8c2306 100644 (file)
@@ -1,3 +1,8 @@
+2003-11-14  Giovanni Bajo  <giovannibajo@libero.it>
+
+        PR c++/2294
+        * g++.dg/lookup/using9.c: New test.
+
 2003-11-14  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/12762
diff --git a/gcc/testsuite/g++.dg/lookup/using9.C b/gcc/testsuite/g++.dg/lookup/using9.C
new file mode 100644 (file)
index 0000000..c622675
--- /dev/null
@@ -0,0 +1,30 @@
+// { 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-error "note" }
+  void f(double);  // { dg-error "note" }
+}
+
+namespace C {
+  void f(int);     // { dg-error "note" }
+  void f(double);  // { dg-error "note" }
+  void f(char);    // { dg-error "note" }
+}
+
+void h()
+{
+  using B::f;
+  using C::f;
+  f('h');
+  f(1);         // { dg-error "ambiguous" }
+  void f(int);  // { dg-error "previous using declaration" }
+}
+
+void m()
+{
+  void f(int);
+  using B::f;   // { dg-error "already declared" }
+}