From ef05493c839bee3d072d23e9cf409d17b4ca602e Mon Sep 17 00:00:00 2001 From: Daniel James Date: Tue, 18 Apr 2017 10:14:26 +0100 Subject: [PATCH] Test that construct/destroy aren't used when C++11 isn't available --- test/objects/test.hpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/test/objects/test.hpp b/test/objects/test.hpp index 14f29ab9..e0e155f9 100644 --- a/test/objects/test.hpp +++ b/test/objects/test.hpp @@ -397,13 +397,6 @@ template class allocator1 detail::tracker.track_construct((void*)p, sizeof(U), tag_); new (p) U(boost::forward(args)...); } -#else - void construct(T* p, T const& t) - { - detail::tracker.track_construct((void*)p, sizeof(T), tag_); - new (p) T(t); - } -#endif template void destroy(U* p) { @@ -413,6 +406,22 @@ template class allocator1 // Work around MSVC buggy unused parameter warning. ignore_variable(&p); } +#else + private: + // I'm going to claim in the documentation that construct/destroy + // is never used when C++11 support isn't available, so might as + // well check that in the text. + // TODO: Or maybe just disallow them for values? + template void construct(U* p); + template void construct(U* p, A0 const&); + template + void construct(U* p, A0 const&, A1 const&); + template + void construct(U* p, A0 const&, A1 const&, A2 const&); + template void destroy(U* p); + + public: +#endif bool operator==(allocator1 const& x) const { return tag_ == x.tag_; }