The following code snippet:

struct B {};
void A(B) {};

namespace N {
void A(B) {}
void f(B b) {A(b);}
}

gives this error (tested with 3.3.6 and 4.0.3):

namespaceconf.cpp: In function 'void N::f()':
namespaceconf.cpp:6: error: call of overloaded 'A(B&)' is ambiguous
namespaceconf.cpp:5: note: candidates are: void N::A(const B&)
namespaceconf.cpp:2: note:                 void A(const B&)

I think it should compile and use N::A() and ignore ::A() according to 3.4.1 1,
6.

Can be worked around by qualifiying the call to A as N::A(b);


-- 
           Summary: Name lookup ambiguity with namespace
           Product: gcc
           Version: 4.0.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gccbug at gammarayburst dot de
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26752

Reply via email to