Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#8055 closed Bugs (fixed)

Including boost/smart_ptr/shared_ptr.hpp produces warnings on clang with libc++

Reported by: Michel Morin Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

On clang with libc++ in a C++03 mode, including boost/smart_ptr/shared_ptr.hpp produces warnings. Here is a test case

#include <boost/smart_ptr/shared_ptr.hpp>
int main(int argc, char* argv[]) { return 0; }

and warnings

boost/smart_ptr/shared_ptr.hpp:491:41: 
warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    shared_ptr( std::unique_ptr< Y, D > && r ): px( r.get() ), pn()
                                        ^
boost/smart_ptr/shared_ptr.hpp:556:51: 
warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    shared_ptr & operator=( std::unique_ptr<Y, D> && r )
                                                  ^
boost/smart_ptr/shared_ptr.hpp:558:55: 
warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        this_type( static_cast< std::unique_ptr<Y, D> && >( r ) ).swap(*this);
                                                      ^

This is because !defined(BOOST_NO_CXX11_SMART_PTR) does not imply !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) in this configuration.

It would be nice to remove warnings by adding !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) guard.

Change History (3)

comment:1 by Peter Dimov, 10 years ago

(In [82927]) Check for BOOST_NO_CXX11_RVALUE_REFERENCES in addition to BOOST_NO_CXX11_SMART_PTR. Refs #8055.

comment:2 by Peter Dimov, 10 years ago

Resolution: fixed
Status: newclosed

(In [82928]) Merged revision(s) 82927 from trunk: Check for BOOST_NO_CXX11_RVALUE_REFERENCES in addition to BOOST_NO_CXX11_SMART_PTR. Fixes #8055.

comment:3 by Michel Morin, 10 years ago

Thanks Peter. Now the warning gets disappeared.

Note: See TracTickets for help on using tickets.