Hello,

I know this may look like issue #15910, but please read still. g++ refuses to
compile the following code because it wants to use std::distance. But if I
remove the code about "class Wx", which is not used anywhere, g++ now uses
::distance without complaining. Whichever the right answer is, g++ is not being
consistent here. Note that comeau and sunCC both use ::distance in both cases.

#include <iterator>

namespace boost
{
    namespace detail {
        struct empty_base {};
        using std::distance;
    }

    template <class T, class B = ::boost::detail::empty_base>
        struct ordered_field_operators1 {};

}


namespace CGAL {

    template <class NT_>
        class Quotient
        : boost::ordered_field_operators1< Quotient<NT_> >
        {
        };

    class MP_Float{};

    namespace INTERN_MP_FLOAT {
        double to_double(const MP_Float&);
        double to_double(const Quotient<MP_Float>&);
    }

    template <class T> class Wx{};

    template <> class Wx< MP_Float >
    {
        public:
            class To_double
            {
                public:
                    double operator()( const MP_Float& x ) const {
                        return INTERN_MP_FLOAT::to_double( x );
                    }
            };
    };

}

typedef CGAL::Quotient<CGAL::MP_Float>                      NT;
namespace C{
    template <class T> struct TutorialR{};
    template <class T> struct Point{};
}
typedef C::Point<C::TutorialR<NT> > Point;
double distance(const Point & p, const Point & q)
{
    return 3;
}
int main()
{
    Point p1;
    Point p2;
    distance(p1,p2);
    return 0;
}


-- 
           Summary: unused code changes the result of name lookup
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: marc dot glisse at normalesup dot org
  GCC host triplet: i486-linux-gnu


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

Reply via email to