Opened 8 years ago

#11066 new Bugs

smart_ptr/detail/sp_convertible.hpp should include <cstddef>

Reported by: Fedor Sergeev <Fedor.Sergeev@…> Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

smart_ptr/detail/sp_convertible.hpp uses std::size_t type but does not include cstddef standard header.

This can lead to errors if <cstddef> is not included by config headers (happens if stdlib configuration part of config headers is disabled).

] cat smart1.cc
#include <boost/smart_ptr/intrusive_ptr.hpp>
] gcc smart1.cc -DBOOST_NO_CONFIG  -I .
In file included from ./boost/smart_ptr/intrusive_ptr.hpp:20:0,
                 from smart1.cc:1:
./boost/smart_ptr/detail/sp_convertible.hpp:61:25: error: 'std::size_t' has not been declared
]

I got this behavior on Solaris (with Solaris Studio compiler first), but I bet it does not matter.

There is a simple fix:

] git diff .
diff --git a/include/boost/smart_ptr/detail/sp_convertible.hpp b/include/boost/smart_ptr/detail/sp_convertible.hpp
index 31b2627..4bba9ed 100644
--- a/include/boost/smart_ptr/detail/sp_convertible.hpp
+++ b/include/boost/smart_ptr/detail/sp_convertible.hpp
@@ -16,6 +16,7 @@
 //  http://www.boost.org/LICENSE_1_0.txt

 #include <boost/config.hpp>
+#include <cstddef>

 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( BOOST_NO_SFINAE )
 # define BOOST_SP_NO_SP_CONVERTIBLE
]

Change History (0)

Note: See TracTickets for help on using tickets.