Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81905 - in trunk: boost/smart_ptr libs/smart_ptr/test
From: glenfe_at_[hidden]
Date: 2012-12-13 13:02:28


Author: glenfe
Date: 2012-12-13 13:02:25 EST (Thu, 13 Dec 2012)
New Revision: 81905
URL: http://svn.boost.org/trac/boost/changeset/81905

Log:
Correct call to init_list in make_shared and allocate_shared. Move g++ failing case into separate test to not mask other issues.
Added:
   trunk/libs/smart_ptr/test/allocate_shared_arrays_init_test.cpp (contents, props changed)
   trunk/libs/smart_ptr/test/make_shared_arrays_init_test.cpp (contents, props changed)
Text files modified:
   trunk/boost/smart_ptr/allocate_shared_array.hpp | 4 ++--
   trunk/boost/smart_ptr/make_shared_array.hpp | 4 ++--
   trunk/libs/smart_ptr/test/Jamfile.v2 | 2 ++
   trunk/libs/smart_ptr/test/allocate_shared_arrays_create_test.cpp | 7 -------
   trunk/libs/smart_ptr/test/make_shared_arrays_create_test.cpp | 7 -------
   5 files changed, 6 insertions(+), 18 deletions(-)

Modified: trunk/boost/smart_ptr/allocate_shared_array.hpp
==============================================================================
--- trunk/boost/smart_ptr/allocate_shared_array.hpp (original)
+++ trunk/boost/smart_ptr/allocate_shared_array.hpp 2012-12-13 13:02:25 EST (Thu, 13 Dec 2012)
@@ -118,7 +118,7 @@
         p3 = reinterpret_cast<T3*>(list);
         p1 = reinterpret_cast<T1*>(p2);
         D2 d2 = static_cast<D2>(s1._internal_get_untyped_deleter());
- d2->init_list<M>(p2, p3);
+ d2->template init_list<M>(p2, p3);
         return boost::shared_ptr<T>(s1, p1);
     }
     template<typename T, typename A>
@@ -142,7 +142,7 @@
         p3 = reinterpret_cast<T3*>(list);
         p1 = reinterpret_cast<T1*>(p2);
         D2 d2 = static_cast<D2>(s1._internal_get_untyped_deleter());
- d2->init_list<M>(p2, p3);
+ d2->template init_list<M>(p2, p3);
         return boost::shared_ptr<T>(s1, p1);
     }
 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)

Modified: trunk/boost/smart_ptr/make_shared_array.hpp
==============================================================================
--- trunk/boost/smart_ptr/make_shared_array.hpp (original)
+++ trunk/boost/smart_ptr/make_shared_array.hpp 2012-12-13 13:02:25 EST (Thu, 13 Dec 2012)
@@ -118,7 +118,7 @@
         p3 = reinterpret_cast<T3*>(list);
         p1 = reinterpret_cast<T1*>(p2);
         D2 d2 = static_cast<D2>(s1._internal_get_untyped_deleter());
- d2->init_list<M>(p2, p3);
+ d2->template init_list<M>(p2, p3);
         return boost::shared_ptr<T>(s1, p1);
     }
     template<typename T>
@@ -141,7 +141,7 @@
         p3 = reinterpret_cast<T3*>(list);
         p1 = reinterpret_cast<T1*>(p2);
         D2 d2 = static_cast<D2>(s1._internal_get_untyped_deleter());
- d2->init_list<M>(p2, p3);
+ d2->template init_list<M>(p2, p3);
         return boost::shared_ptr<T>(s1, p1);
     }
 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)

Modified: trunk/libs/smart_ptr/test/Jamfile.v2
==============================================================================
--- trunk/libs/smart_ptr/test/Jamfile.v2 (original)
+++ trunk/libs/smart_ptr/test/Jamfile.v2 2012-12-13 13:02:25 EST (Thu, 13 Dec 2012)
@@ -139,6 +139,7 @@
           [ run make_shared_array_create_test.cpp ]
           [ run make_shared_array_init_test.cpp ]
           [ run make_shared_arrays_create_test.cpp ]
+ [ run make_shared_arrays_init_test.cpp ]
           [ run make_shared_array_throws_test.cpp ]
           [ run make_shared_array_esft_test.cpp ]
           [ run make_shared_array_args_test.cpp ]
@@ -147,6 +148,7 @@
           [ run allocate_shared_array_create_test.cpp ]
           [ run allocate_shared_array_init_test.cpp ]
           [ run allocate_shared_arrays_create_test.cpp ]
+ [ run allocate_shared_arrays_init_test.cpp ]
           [ run allocate_shared_array_throws_test.cpp ]
           [ run allocate_shared_array_esft_test.cpp ]
           [ run allocate_shared_array_args_test.cpp ]

Modified: trunk/libs/smart_ptr/test/allocate_shared_arrays_create_test.cpp
==============================================================================
--- trunk/libs/smart_ptr/test/allocate_shared_arrays_create_test.cpp (original)
+++ trunk/libs/smart_ptr/test/allocate_shared_arrays_create_test.cpp 2012-12-13 13:02:25 EST (Thu, 13 Dec 2012)
@@ -72,13 +72,6 @@
         BOOST_TEST(a1[2] == 2);
         BOOST_TEST(a1[3] == 3);
     }
- {
- boost::shared_ptr<int[][2]> a1 = boost::allocate_shared<int[][2]>(std::allocator<int>(), { {0, 1}, {2, 3} });
- BOOST_TEST(a1[0][0] == 0);
- BOOST_TEST(a1[0][1] == 1);
- BOOST_TEST(a1[1][0] == 2);
- BOOST_TEST(a1[1][1] == 3);
- }
 #endif
 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
     {

Added: trunk/libs/smart_ptr/test/allocate_shared_arrays_init_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/smart_ptr/test/allocate_shared_arrays_init_test.cpp 2012-12-13 13:02:25 EST (Thu, 13 Dec 2012)
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2012 Glen Joseph Fernandes
+ * glenfe at live dot com
+ *
+ * Distributed under the Boost Software License,
+ * Version 1.0. (See accompanying file LICENSE_1_0.txt
+ * or copy at http://boost.org/LICENSE_1_0.txt)
+ */
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/smart_ptr/allocate_shared_array.hpp>
+
+int main() {
+#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
+ {
+ boost::shared_ptr<int[][2]> a1 = boost::allocate_shared<int[][2]>(std::allocator<int>(), { {0, 1}, {2, 3} });
+ BOOST_TEST(a1[0][0] == 0);
+ BOOST_TEST(a1[0][1] == 1);
+ BOOST_TEST(a1[1][0] == 2);
+ BOOST_TEST(a1[1][1] == 3);
+ }
+#endif
+ return boost::report_errors();
+}

Modified: trunk/libs/smart_ptr/test/make_shared_arrays_create_test.cpp
==============================================================================
--- trunk/libs/smart_ptr/test/make_shared_arrays_create_test.cpp (original)
+++ trunk/libs/smart_ptr/test/make_shared_arrays_create_test.cpp 2012-12-13 13:02:25 EST (Thu, 13 Dec 2012)
@@ -72,13 +72,6 @@
         BOOST_TEST(a1[2] == 2);
         BOOST_TEST(a1[3] == 3);
     }
- {
- boost::shared_ptr<int[][2]> a1 = boost::make_shared<int[][2]>({ {0, 1}, {2, 3} });
- BOOST_TEST(a1[0][0] == 0);
- BOOST_TEST(a1[0][1] == 1);
- BOOST_TEST(a1[1][0] == 2);
- BOOST_TEST(a1[1][1] == 3);
- }
 #endif
 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
     {

Added: trunk/libs/smart_ptr/test/make_shared_arrays_init_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/smart_ptr/test/make_shared_arrays_init_test.cpp 2012-12-13 13:02:25 EST (Thu, 13 Dec 2012)
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2012 Glen Joseph Fernandes
+ * glenfe at live dot com
+ *
+ * Distributed under the Boost Software License,
+ * Version 1.0. (See accompanying file LICENSE_1_0.txt
+ * or copy at http://boost.org/LICENSE_1_0.txt)
+ */
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/smart_ptr/make_shared_array.hpp>
+
+int main() {
+#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
+ {
+ boost::shared_ptr<int[][2]> a1 = boost::make_shared<int[][2]>({ {0, 1}, {2, 3} });
+ BOOST_TEST(a1[0][0] == 0);
+ BOOST_TEST(a1[0][1] == 1);
+ BOOST_TEST(a1[1][0] == 2);
+ BOOST_TEST(a1[1][1] == 3);
+ }
+#endif
+ return boost::report_errors();
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk