Opened 3 years ago

Last modified 4 months 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 Changed 3 years ago by anonymous

It's really driving me nuts.

The only way I'm keeping sane, is to use this compile flag:

-Wno-deprecated-declarations

comment:2 Changed 3 years ago by Frank Mori Hess

Component: signals2smart_ptr
Owner: changed from Frank Mori Hess to Peter Dimov

These warnings aren't coming (directly) from Boost.Signals2 they are coming from the smart pointers library.

comment:4 Changed 2 years ago by jack@…

Cc: jack@… 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:5 Changed 17 months ago by anonymous

still an issue in the 1.64.0 Release.

comment:6 Changed 17 months ago by Peter Dimov

The Spirit issue, or something in smart_ptr?

comment:7 Changed 12 months ago by nenad.miksa@…

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 Changed 12 months ago by anonymous

/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 Changed 8 months ago by Tony E Lewis <TonyELewis@…>

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 Changed 5 months ago by vanriper.trey@…

I'm seeing these warnings in boost.locale within 1.66, using gnu g++ version 5.4.0.

comment:11 Changed 4 months ago by blair@…

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

Note: See TracTickets for help on using tickets.