Opened 7 years ago
Last modified 4 years ago
#11622 new Bugs
std::auto_ptr is deprecated
Reported by: | anonymous | Owned by: | Peter Dimov |
---|---|---|---|
Milestone: | To Be Determined | Component: | smart_ptr |
Version: | Boost 1.59.0 | Severity: | Cosmetic |
Keywords: | Cc: | jack@… |
Description
Hi,
I'm using Boost 1.59 and compiling a signals2 program using a new compiler: gcc 5.2.1.
My code is now littered with warnings!! warning: ‘template<class> class std::auto_ptr’ is deprecated
and indeed: Checking it here http://en.cppreference.com/w/cpp/memory/auto_ptr I see: "deprecated since C++11"
(Seems that std::unique_ptr is the favoured replacement.)
Here's the output of an online compiler: http://melpon.org/wandbox/permlink/7QyVTXZ51MVonsgv
Change History (11)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
Component: | signals2 → smart_ptr |
---|---|
Owner: | changed from | to
These warnings aren't coming (directly) from Boost.Signals2 they are coming from the smart pointers library.
comment:3 by , 7 years ago
comment:4 by , 6 years ago
Cc: | added |
---|
Compiling Zcash with -Werror
using Boost 1.62.0 (which includes the above fix), I still get this error:
In file included from /home/str4d/dev/zcash/zcash/depends/x86_64-unknown-linux-gnu/include/boost/spirit/home/classic/core/non_terminal/grammar.hpp:21:0, from /home/str4d/dev/zcash/zcash/depends/x86_64-unknown-linux-gnu/include/boost/spirit/home/classic/core.hpp:42, from /home/str4d/dev/zcash/zcash/depends/x86_64-unknown-linux-gnu/include/boost/spirit/include/classic_core.hpp:11, from json/json_spirit_reader_template.h:19, from asyncrpcoperation.h:20, from asyncrpcqueue.h:8, from asyncrpcqueue.cpp:5: /home/str4d/dev/zcash/zcash/depends/x86_64-unknown-linux-gnu/include/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp: In member function ‘boost::spirit::classic::impl::grammar_helper<GrammarT, DerivedT, ScannerT>::definition_t& boost::spirit::classic::impl::grammar_helper<GrammarT, DerivedT, ScannerT>::define(const grammar_t*)’: /home/str4d/dev/zcash/zcash/depends/x86_64-unknown-linux-gnu/include/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp:159:18: error: ‘template<class> class std::auto_ptr’ is deprecated [-Werror=deprecated-declarations] std::auto_ptr<definition_t> ^ In file included from /usr/include/c++/5/memory:81:0, from asyncrpcoperation.h:13, from asyncrpcqueue.h:8, from asyncrpcqueue.cpp:5: /usr/include/c++/5/bits/unique_ptr.h:49:28: note: declared here template<typename> class auto_ptr; ^
It seems that the fix applied to the smart pointers library needs to be expanded to all libraries that use auto_ptr
.
comment:7 by , 5 years ago
libc++ v5 (available in AUR on ArchLinux) does not have auto_ptr header anymore, if compiling with flag -std=gnu++1z
, so this is now a compile error, not a warning anymore:
boost/include/boost/ptr_container/ptr_sequence_adapter.hpp:223:45: error: no type named 'auto_ptr' in namespace 'std' explicit ptr_sequence_adapter( std::auto_ptr<PtrContainer> clone ) ~~~~~^
comment:8 by , 5 years ago
/usr/local/include/boost/statechart/processor_container.hpp:67:16: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
typedef std::auto_ptr< processor_base_type > processor_holder_type;
comment:9 by , 5 years ago
I just hit this issue whilst trying to use Boost 1.66 with C++17.
But from what I can see the C++17 issue has been fixed since 1.66 in b805b3c.
I don't know how that affects the original deprecated warnings issue, though it looks as though there are several more commits about this in the last couple of months.
To anyone having problems with the warnings: can you work around the problem by specifying the Boost include using -isystem
?
comment:10 by , 4 years ago
I'm seeing these warnings in boost.locale within 1.66, using gnu g++ version 5.4.0.
comment:11 by , 4 years ago
I'm getting these errors when trying to install R dependencies for lubridate and forecast....
/usr/local/lib/R/site-library/BH/include/boost/smart_ptr/scoped_ptr.hpp:74:31: warning: 'template<class> class std::auto_ptr' is deprecated
It's really driving me nuts.
The only way I'm keeping sane, is to use this compile flag: