From e36689bd5ed47bb53772ccf7be0e87e2ed93d615 Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Thu, 13 Dec 2012 18:02:25 +0000 Subject: [PATCH] Correct call to init_list in make_shared and allocate_shared. Move g++ failing case into separate test to not mask other issues. [SVN r81905] --- .../boost/smart_ptr/allocate_shared_array.hpp | 4 ++-- include/boost/smart_ptr/make_shared_array.hpp | 4 ++-- test/Jamfile.v2 | 2 ++ test/allocate_shared_arrays_create_test.cpp | 7 ------ test/allocate_shared_arrays_init_test.cpp | 23 +++++++++++++++++++ test/make_shared_arrays_create_test.cpp | 7 ------ test/make_shared_arrays_init_test.cpp | 23 +++++++++++++++++++ 7 files changed, 52 insertions(+), 18 deletions(-) create mode 100644 test/allocate_shared_arrays_init_test.cpp create mode 100644 test/make_shared_arrays_init_test.cpp diff --git a/include/boost/smart_ptr/allocate_shared_array.hpp b/include/boost/smart_ptr/allocate_shared_array.hpp index 2eb5ba5..3ee1655 100644 --- a/include/boost/smart_ptr/allocate_shared_array.hpp +++ b/include/boost/smart_ptr/allocate_shared_array.hpp @@ -118,7 +118,7 @@ namespace boost { p3 = reinterpret_cast(list); p1 = reinterpret_cast(p2); D2 d2 = static_cast(s1._internal_get_untyped_deleter()); - d2->init_list(p2, p3); + d2->template init_list(p2, p3); return boost::shared_ptr(s1, p1); } template @@ -142,7 +142,7 @@ namespace boost { p3 = reinterpret_cast(list); p1 = reinterpret_cast(p2); D2 d2 = static_cast(s1._internal_get_untyped_deleter()); - d2->init_list(p2, p3); + d2->template init_list(p2, p3); return boost::shared_ptr(s1, p1); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) diff --git a/include/boost/smart_ptr/make_shared_array.hpp b/include/boost/smart_ptr/make_shared_array.hpp index 609a098..eb0578d 100644 --- a/include/boost/smart_ptr/make_shared_array.hpp +++ b/include/boost/smart_ptr/make_shared_array.hpp @@ -118,7 +118,7 @@ namespace boost { p3 = reinterpret_cast(list); p1 = reinterpret_cast(p2); D2 d2 = static_cast(s1._internal_get_untyped_deleter()); - d2->init_list(p2, p3); + d2->template init_list(p2, p3); return boost::shared_ptr(s1, p1); } template @@ -141,7 +141,7 @@ namespace boost { p3 = reinterpret_cast(list); p1 = reinterpret_cast(p2); D2 d2 = static_cast(s1._internal_get_untyped_deleter()); - d2->init_list(p2, p3); + d2->template init_list(p2, p3); return boost::shared_ptr(s1, p1); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 9f08375..1ed197a 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -139,6 +139,7 @@ import testing ; [ 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 @@ import testing ; [ 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 ] diff --git a/test/allocate_shared_arrays_create_test.cpp b/test/allocate_shared_arrays_create_test.cpp index 8a2a7d8..a7e95d7 100644 --- a/test/allocate_shared_arrays_create_test.cpp +++ b/test/allocate_shared_arrays_create_test.cpp @@ -72,13 +72,6 @@ int main() { BOOST_TEST(a1[2] == 2); BOOST_TEST(a1[3] == 3); } - { - boost::shared_ptr a1 = boost::allocate_shared(std::allocator(), { {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) { diff --git a/test/allocate_shared_arrays_init_test.cpp b/test/allocate_shared_arrays_init_test.cpp new file mode 100644 index 0000000..76173fa --- /dev/null +++ b/test/allocate_shared_arrays_init_test.cpp @@ -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 +#include + +int main() { +#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + { + boost::shared_ptr a1 = boost::allocate_shared(std::allocator(), { {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(); +} diff --git a/test/make_shared_arrays_create_test.cpp b/test/make_shared_arrays_create_test.cpp index ba22e4a..c6a1b4f 100644 --- a/test/make_shared_arrays_create_test.cpp +++ b/test/make_shared_arrays_create_test.cpp @@ -72,13 +72,6 @@ int main() { BOOST_TEST(a1[2] == 2); BOOST_TEST(a1[3] == 3); } - { - boost::shared_ptr a1 = boost::make_shared({ {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) { diff --git a/test/make_shared_arrays_init_test.cpp b/test/make_shared_arrays_init_test.cpp new file mode 100644 index 0000000..1646d5a --- /dev/null +++ b/test/make_shared_arrays_init_test.cpp @@ -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 +#include + +int main() { +#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + { + boost::shared_ptr a1 = boost::make_shared({ {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(); +}