from c.l.c.moderated by Maxim Yegorushkin:

#include <algorithm>

namespace N {

#ifdef SHOW_BUG

struct A
{
};
int swap(A&, A&);

#else

struct A
{
      friend int swap(A&, A&);
};

#endif

struct B : A
{
};

void swap(B& x, B& y)
{
      using std::swap;
      typedef char a[sizeof(swap(static_cast<A&>(x), static_cast<A&>(y))) ?
1 : -1] ; // compiles only if int swap(A&, A&) is found
}

}

-- 
           Summary: name lookup / friend function
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sstrasser at systemhaus-gruppe dot de
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to