Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#462 closed defect (duplicate)

Geos does not compile with clang (LLVM) [GeometryFactory.h errors]

Reported by: vince Owned by: pramsey
Priority: major Milestone: 3.3.1
Component: Build/Install Version: 3.3.0
Severity: Critical Keywords: clang casts GeometryFactory
Cc:

Description (last modified by mloskot)

Apparently, g++ does not object to implicit conversions from geos::geom::GeometryCollection? * (or other geometry types) to std::auto_ptr<Geometry>, but clang raises an error:

libtool: compile:  /Developer/usr/bin/clang++ -DHAVE_CONFIG_H -I. -I../../include -I../../include/geos -I../../include -I/usr/pkg/include -DGEOS_INLINE -pedantic -Wall -ansi -Wno-long-long -pipe -O2 -arch x86_64 -MT ConvexHull.lo -MD -MP -MF .deps/ConvexHull.Tpo -c ConvexHull.cpp  -fno-common -DPIC -o .libs/ConvexHull.o

In file included from ConvexHull.cpp:23:
../../include/geos/geom/GeometryFactory.h:323:14: error: no matching conversion for functional-style cast from 'geos::geom::GeometryCollection *' to 'std::auto_ptr<Geometry>'
      return std::auto_ptr<Geometry>( createGeometryCollection() );
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/4.2.1/memory:189:7: note: candidate constructor not viable: cannot convert argument of incomplete type 'geos::geom::GeometryCollection *' to 'element_type *' (aka 'geos::geom::Geometry *')
      auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { }
      ^
/usr/include/c++/4.2.1/memory:198:7: note: candidate constructor not viable: cannot convert argument of incomplete type 'geos::geom::GeometryCollection *' to 'std::auto_ptr<geos::geom::Geometry> &'
      auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { }
      ^
/usr/include/c++/4.2.1/memory:348:7: note: candidate constructor not viable: cannot convert argument of incomplete type 'geos::geom::GeometryCollection *' to 'auto_ptr_ref<element_type>'
      auto_ptr(auto_ptr_ref<element_type> __ref) throw()
      ^
/usr/include/c++/4.2.1/memory:211:9: note: candidate template ignored: failed template argument deduction
        auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { }
        ^
In file included from ConvexHull.cpp:23:
../../include/geos/geom/GeometryFactory.h:346:14: error: no matching conversion for functional-style cast from 'geos::geom::GeometryCollection *' to 'std::auto_ptr<Geometry>'
      return std::auto_ptr<Geometry>( createGeometryCollection(fromGeoms) );
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/4.2.1/memory:189:7: note: candidate constructor not viable: cannot convert argument of incomplete type 'geos::geom::GeometryCollection *' to 'element_type *' (aka 'geos::geom::Geometry *')
      auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { }
      ^
/usr/include/c++/4.2.1/memory:198:7: note: candidate constructor not viable: cannot convert argument of incomplete type 'geos::geom::GeometryCollection *' to 'std::auto_ptr<geos::geom::Geometry> &'
      auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { }
      ^
/usr/include/c++/4.2.1/memory:348:7: note: candidate constructor not viable: cannot convert argument of incomplete type 'geos::geom::GeometryCollection *' to 'auto_ptr_ref<element_type>'
      auto_ptr(auto_ptr_ref<element_type> __ref) throw()
      ^
/usr/include/c++/4.2.1/memory:211:9: note: candidate template ignored: failed template argument deduction
        auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { }
        ^
In file included from ConvexHull.cpp:23:
../../include/geos/geom/GeometryFactory.h:351:14: error: no matching conversion for functional-style cast from 'geos::geom::MultiPolygon *' to 'std::auto_ptr<Geometry>'
      return std::auto_ptr<Geometry>( createMultiPolygon(fromGeoms) );
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/4.2.1/memory:189:7: note: candidate constructor not viable: cannot convert argument of incomplete type 'geos::geom::MultiPolygon *' to 'element_type *' (aka 'geos::geom::Geometry *')
      auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { }
      ^
/usr/include/c++/4.2.1/memory:198:7: note: candidate constructor not viable: cannot convert argument of incomplete type 'geos::geom::MultiPolygon *' to 'std::auto_ptr<geos::geom::Geometry> &'
      auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { }
      ^
/usr/include/c++/4.2.1/memory:348:7: note: candidate constructor not viable: cannot convert argument of incomplete type 'geos::geom::MultiPolygon *' to 'auto_ptr_ref<element_type>'
      auto_ptr(auto_ptr_ref<element_type> __ref) throw()
      ^
/usr/include/c++/4.2.1/memory:211:9: note: candidate template ignored: failed template argument deduction
        auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { }
        ^
In file included from ConvexHull.cpp:23:
../../include/geos/geom/GeometryFactory.h:353:14: error: no matching conversion for functional-style cast from 'geos::geom::MultiLineString *' to 'std::auto_ptr<Geometry>'
      return std::auto_ptr<Geometry>( createMultiLineString(fromGeoms) );
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/4.2.1/memory:189:7: note: candidate constructor not viable: cannot convert argument of incomplete type 'geos::geom::MultiLineString *' to 'element_type *' (aka 'geos::geom::Geometry *')
      auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { }
      ^
/usr/include/c++/4.2.1/memory:198:7: note: candidate constructor not viable: cannot convert argument of incomplete type 'geos::geom::MultiLineString *' to 'std::auto_ptr<geos::geom::Geometry> &'
      auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { }
      ^
/usr/include/c++/4.2.1/memory:348:7: note: candidate constructor not viable: cannot convert argument of incomplete type 'geos::geom::MultiLineString *' to 'auto_ptr_ref<element_type>'
      auto_ptr(auto_ptr_ref<element_type> __ref) throw()
      ^
/usr/include/c++/4.2.1/memory:211:9: note: candidate template ignored: failed template argument deduction
        auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { }
        ^
In file included from ConvexHull.cpp:23:
../../include/geos/geom/GeometryFactory.h:355:14: error: no matching conversion for functional-style cast from 'geos::geom::MultiPoint *' to 'std::auto_ptr<Geometry>'
      return std::auto_ptr<Geometry>( createMultiPoint(fromGeoms) );
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/4.2.1/memory:189:7: note: candidate constructor not viable: cannot convert argument of incomplete type 'geos::geom::MultiPoint *' to 'element_type *' (aka 'geos::geom::Geometry *')
      auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { }
      ^
/usr/include/c++/4.2.1/memory:198:7: note: candidate constructor not viable: cannot convert argument of incomplete type 'geos::geom::MultiPoint *' to 'std::auto_ptr<geos::geom::Geometry> &'
      auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { }
      ^
/usr/include/c++/4.2.1/memory:348:7: note: candidate constructor not viable: cannot convert argument of incomplete type 'geos::geom::MultiPoint *' to 'auto_ptr_ref<element_type>'
      auto_ptr(auto_ptr_ref<element_type> __ref) throw()
      ^
/usr/include/c++/4.2.1/memory:211:9: note: candidate template ignored: failed template argument deduction
        auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { }
        ^

It might be necessary to insert dynamic or static casts.

Change History (2)

comment:1 Changed 10 years ago by strk

Resolution: duplicate
Status: newclosed

Duplicate of #463

comment:2 Changed 10 years ago by mloskot

Description: modified (diff)
Note: See TracTickets for help on using tickets.