
On 11/28/05, Mick Hollins
The following code causes a runtime assertion in VC 8.0:
std::string l_param; std::string l_str = (boost::format("here is an empty string: %1%") % l_param).str();
It passes an empty string argument to boost::format. The assert is inside the implementation of basic_string::append() and boils down to the fact that the implementation of boost::format ends up calling basic_string::append(const char *, size_type) with a null pointer, which causes basic_string::append to assert.
::_Inside(const char * _Ptr=0x00000000) Line 2023 + 0x13 bytes C++ msvcp80d.dll!std::basic_string
& res="", const char * beg=0x00000000, unsigned int size=0, int w=0, const char fill_char=' ', int f=513, const char prefix_space=0, bool
This assertion seems to only happen with /MDd (e.g. debug runtime), but I'd
say it qualifies as a bug in Boost.Format.
Here's the stack trace:
msvcp80d.dll!std::_Debug_message(const wchar_t * message=0x105157a0,
const wchar_t * file=0x10514a0c, unsigned int line=2023) Line 23 C++
msvcp80d.dll!std::_Debug_pointer<char>(const char * _First=0x00000000,
const wchar_t * _File=0x10514a0c, unsigned int _Line=2023) Line 1334 + 0x12
bytes C++
msvcp80d.dll!std::basic_string const &>(const
std::basic_string (const std::basic_string And here's the offending code from boost::io::detail::mk_str
(feed_args.hpp):
typedef typename std::basic_string