Merge branch 'develop' of https://github.com/boostorg/smart_ptr into cppbuilder

This commit is contained in:
Edward Diener
2020-04-19 02:49:06 -04:00
15 changed files with 185 additions and 23 deletions
+9
View File
@@ -352,3 +352,12 @@ run allocate_unique_noinit_test.cpp ;
run allocate_unique_test.cpp ;
run allocate_unique_throws_test.cpp ;
run allocate_unique_value_test.cpp ;
run sp_guides_test.cpp ;
run sp_guides_test2.cpp ;
run wp_guides_test.cpp ;
compile-fail shared_from_fail.cpp ;
compile-fail weak_from_fail.cpp ;
compile sp_override_test.cpp ;
+22
View File
@@ -0,0 +1,22 @@
// Copyright 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/shared_ptr.hpp>
#include <boost/smart_ptr/enable_shared_from.hpp>
struct X: public boost::enable_shared_from
{
};
#if defined(__clang__) && defined(_MSC_VER)
// clang-cl claims that it accepts this code for compatibility
// with msvc, but no version of msvc accepts it
# pragma clang diagnostic error "-Wmicrosoft-using-decl"
#endif
int main()
{
boost::shared_ptr<X> px( new X );
px->shared_from_this();
}
+25
View File
@@ -0,0 +1,25 @@
// Copyright 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#if defined(__cpp_deduction_guides)
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
int main()
{
boost::shared_ptr<int> p1( new int );
boost::weak_ptr<int> p2( p1 );
boost::shared_ptr p3( p2 );
}
#else
#include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE( "Skipping test because __cpp_deduction_guides is not defined" )
int main() {}
#endif
+23
View File
@@ -0,0 +1,23 @@
// Copyright 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#if defined(__cpp_deduction_guides)
#include <boost/shared_ptr.hpp>
#include <memory>
int main()
{
boost::shared_ptr p2( std::unique_ptr<int>( new int ) );
}
#else
#include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE( "Skipping test because __cpp_deduction_guides is not defined" )
int main() {}
#endif
+18
View File
@@ -0,0 +1,18 @@
// Copyright 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#if defined(__GNUC__) && __GNUC__ >= 5 && __cplusplus >= 201103L
# pragma GCC diagnostic error "-Wsuggest-override"
#endif
#include <boost/smart_ptr.hpp>
int main()
{
boost::shared_ptr<int> p1( new int );
boost::shared_ptr<int[]> p2( new int[1] );
boost::make_shared<int>();
boost::make_shared<int[]>( 1 );
}
+22
View File
@@ -0,0 +1,22 @@
// Copyright 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/shared_ptr.hpp>
#include <boost/smart_ptr/enable_shared_from.hpp>
struct X: public boost::enable_shared_from
{
};
#if defined(__clang__) && defined(_MSC_VER)
// clang-cl claims that it accepts this code for compatibility
// with msvc, but no version of msvc accepts it
# pragma clang diagnostic error "-Wmicrosoft-using-decl"
#endif
int main()
{
boost::shared_ptr<X> px( new X );
px->weak_from_this();
}
+24
View File
@@ -0,0 +1,24 @@
// Copyright 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#if defined(__cpp_deduction_guides)
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
int main()
{
boost::shared_ptr<int> p1( new int );
boost::weak_ptr p2( p1 );
}
#else
#include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE( "Skipping test because __cpp_deduction_guides is not defined" )
int main() {}
#endif