This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12131] New: Argument dependent lookup considered even when it should not


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Argument dependent lookup considered even when it should
                    not
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sylvain dot pion at sophia dot inria dot fr
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu

Compiling the code below produced the error message :

bug_1.C: In function `void g(const T&) [with T = A::C]':
bug_1.C:20:   instantiated from here
bug_1.C:15: error: call of overloaded `f(const A::C&)' is ambiguous
bug_1.C:4: note: candidates are: void A::B::f(const T&) [with T = A::C]
bug_1.C:9: note:                 void A::f(const T&) [with T = A::C]

I believe it should not, since the call to f is qualified by A::B::, then
A::f should not be considered.  All previous versions of g++ (2.95, 3.2, 3.3)
work.

namespace A {

  namespace B {
    template < typename T > void f(const T&) {}
  }

  class C {};

  template < typename T > void f(const T&) { }
}

template < typename T >
void g(const T& t)
{
  A::B::f(t);
}

int main() {
  A::C c;
  g(c);
  return 0;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]