The following code compiles. It shouldn't. The operator+ should not be found.
According to 3.4.2/2, the associated namespace of a type includes those of its
bases and of its template arguments, but not its bases' template arguments.

namespace N
{
    struct S {};
    template<class T, class U>
    void operator+(T const &, U const &) {}
}

template<class T> struct X {};
struct Y : X<N::S> {};

int main()
{
    Y y;
    y+y; // this should fail.
}


-- 
           Summary: Overeager ADL searches associated namespaces of base
                    class's template arguments
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eric dot niebler at gmail dot com
 GCC build triplet: g++ 4.3.0


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

Reply via email to