https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110636

            Bug ID: 110636
           Summary: boost::geometry compile error with std::set.
           Product: gcc
           Version: og12 (devel/omp/gcc-12)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: justin at jtcholzer dot net
  Target Milestone: ---

At work, we ran across this upgrading from GCC 9 to GCC 12.
This is a trivial example.  In our large code base we use a "unity build" that
mixes including of .h and .cpp files to speed linking.  We worked around the
issue by removing "using std::set;" from all files.

$ g++ --version
g++ (Debian 12.2.0-14) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ apt search libboost-dev
Sorting... Done
Full Text Search... Done
libboost-dev/stable,oldstable,testing,now 1.74.0.3 amd64 [installed]
  Boost C++ Libraries development files (default version)

///////// main.cpp ////////////////
#include <set>

//!!!! this before geometry.hpp include triggers the error !!!!!
using std::set;

#include <boost/geometry.hpp>


int main(int argc, char** argv)
{
    return 0;
}
///////////////////////////////////

$ make
g++ -c main.cpp -o main.o -std=c++14
In file included from
/usr/include/boost/geometry/strategies/geographic/distance.hpp:38,
                 from
/usr/include/boost/geometry/strategies/strategies.hpp:113,
                 from /usr/include/boost/geometry/geometry.hpp:58,
                 from /usr/include/boost/geometry.hpp:17,
                 from main.cpp:6:
/usr/include/boost/geometry/geometries/point_xy.hpp: In member function ‘void
boost::geometry::model::d2::point_xy<CoordinateType, CoordinateSystem>::x(const
CoordinateType&)’:
/usr/include/boost/geometry/geometries/point_xy.hpp:74:27: error: type/value
mismatch at argument 1 in template parameter list for ‘template<class _Key,
class _Compare, class _Alloc> class std::set’
   74 |     { this->template set<0>(v); }
      |                           ^
/usr/include/boost/geometry/geometries/point_xy.hpp:74:27: note:   expected a
type, got ‘0’
/usr/include/boost/geometry/geometries/point_xy.hpp:74:27: error: template
argument 2 is invalid
/usr/include/boost/geometry/geometries/point_xy.hpp:74:27: error: template
argument 3 is invalid
/usr/include/boost/geometry/geometries/point_xy.hpp: In member function ‘void
boost::geometry::model::d2::point_xy<CoordinateType, CoordinateSystem>::y(const
CoordinateType&)’:
/usr/include/boost/geometry/geometries/point_xy.hpp:78:27: error: type/value
mismatch at argument 1 in template parameter list for ‘template<class _Key,
class _Compare, class _Alloc> class std::set’
   78 |     { this->template set<1>(v); }
      |                           ^
/usr/include/boost/geometry/geometries/point_xy.hpp:78:27: note:   expected a
type, got ‘1’
/usr/include/boost/geometry/geometries/point_xy.hpp:78:27: error: template
argument 2 is invalid
/usr/include/boost/geometry/geometries/point_xy.hpp:78:27: error: template
argument 3 is invalid
In file included from /usr/include/boost/math/tools/cxx03_warn.hpp:9,
                 from /usr/include/boost/math/constants/constants.hpp:11,
                 from /usr/include/boost/geometry/util/math.hpp:29,
                 from /usr/include/boost/geometry/core/radian_access.hpp:33,
                 from /usr/include/boost/geometry/geometry.hpp:51:
/usr/include/boost/detail/no_exceptions_support.hpp: At global scope:
/usr/include/boost/detail/no_exceptions_support.hpp:17:1: note: ‘#pragma
message: This header is deprecated. Use <boost/core/no_exceptions_support.hpp>
instead.’
   17 | BOOST_HEADER_DEPRECATED("<boost/core/no_exceptions_support.hpp>")
      | ^~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:4: compile] Error 1

Reply via email to