Opened 8 years ago
Closed 5 years ago
#785 closed defect (wontfix)
g++ 6 auto_ptr
Reported by: | rsbivand | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 3.8.0 |
Component: | Default | Version: | 3.5.0 |
Severity: | Unassigned | Keywords: | |
Cc: |
Description
The use of auto_ptr throws warnings in g++ 6 in Fedora 24, chiefly in XMLTester:
In file included from ../../include/geos/geom/Geometry.h:27:0, from ../../include/geos/geom/Point.h:26, from XMLTester.cpp:27: ../../include/geos/geom/Envelope.h: At global scope: ../../include/geos/geom/Envelope.h:57:15: warning: ‘template<class> class std::auto_ptr’ is deprecated [-Wdeprecated-declarations] typedef std::auto_ptr<Envelope> AutoPtr; ^~~~~~~~ In file included from /usr/include/c++/6.1.1/memory:81:0, from ../../include/geos/geom/Envelope.h:29, from ../../include/geos/geom/Geometry.h:27, from ../../include/geos/geom/Point.h:26, from XMLTester.cpp:27: /usr/include/c++/6.1.1/bits/unique_ptr.h:49:28: note: declared here template<typename> class auto_ptr; ^~~~~~~~
There are other wanings for other types of -W, such as the following, so it looks as though g++ 6 is stricter in checking:
WKTWriter.cpp: In member function ‘void geos::io::WKTWriter::appendPointTaggedText(const geos::geom::Coordinate*, int, geos::io::Writer*)’: WKTWriter.cpp:239:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] if( outputDimension == 3 && !old3D && coordinate != NULL ) ^~ WKTWriter.cpp:242:2: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ appendPointText(coordinate, level, writer); ^~~~~~~~~~~~~~~
Change History (8)
comment:1 by , 8 years ago
follow-up: 3 comment:2 by , 8 years ago
auto_ptr and unique_ptr have very similar behaviour and API and can be used equivalently if you make basic uses of them (check the differences to see if you're not running into them)
In GDAL there's a driver making use of auto_ptr, and I've finally done
#if __cplusplus >= 201103L #define UNIQUEPTR std::unique_ptr #else #define UNIQUEPTR std::auto_ptr #endif
A bit ugly, but works fine.
comment:3 by , 8 years ago
Replying to rouault:
In GDAL there's a driver making use of auto_ptr, and I've finally done
#if __cplusplus >= 201103L #define UNIQUEPTR std::unique_ptr #else #define UNIQUEPTR std::auto_ptr #endif
For sake, typedef!
comment:5 by , 8 years ago
I'd rather leave it as it is and wait until we can switch to c++0x/11 compilers and to std::unique_ptr
only.
If GEOS switches to C++11, I will actively participate in the 'upgrade' refactoring.
comment:7 by , 6 years ago
Milestone: | 3.5.2 → 3.8.0 |
---|
comment:8 by , 5 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I think this can be considered closed now that current GEOS uses C++11, and we aren't going to backport C++11 features into stable branches.
I'm afraid we are not ready to deprecate auto_ptr yet.