Boost logo

Boost :

Subject: [boost] [Polygon] Unqualified name lookup of 'gtlsort' in templates
From: Doug Gregor (doug.gregor_at_[hidden])
Date: 2011-03-06 23:31:02


The Polygon library has a minor C++ standards-conformance issue w.r.t.
unqualified name lookup in templates for 'gtlsort' operator. In
particular, the header <boost/polygon/polygon.hpp> includes a number
of source files that make unqualified calls to 'gtlsort'. 'gtlsort'
itself is not defined until much later, when
<boost/polygon/detail/scan_arbitrary.hpp> pulls in
<boost/detail/polygon_sort_adaptor.hpp>. At least in the cases used in
the Boost.Polygon test, 'gtlsort' isn't found by ADL at instantiation
time, either.

Clang detects this conformance problem, which is described here:

  http://clang.llvm.org/compatibility.html#dep_lookup

The solution is to provide forward declarations of the two 'gtlsort'
overloads in a header that all users of 'gtlsort' depend on. For
example, introducing a forward header containing

namespace boost { namespace polygon {
  template <typename iter_type>
  void gtlsort(iter_type _b_, iter_type _e_);

  template <typename iter_type, typename pred_type>
  void gtlsort(iter_type _b_, iter_type _e_, const pred_type& _pred_);
} }

and including it before the users of 'gtlsort' would work fine.

  - Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk