Boost logo

Boost :

From: Alexander Konovalenko (a-konovalenko_at_[hidden])
Date: 2004-11-23 11:01:45

boost::posix_time::time_from_string() terminates the program due to a
failed assertion on certain inputs.

Boost version used: 1.31.0. Compiler used: GCC 3.3.4. (All the tools come
from pre-built Debian GNU/Linux packages.) I didn't find a fix for this
problem in the latest change log.

Running the attached test program (see the source) gives the following

date_format_bug_demo: /usr/include/boost/token_iterator.hpp:59: const Type&
boost::token_iterator<TokenizerFunc, Iterator, Type>::dereference() const
[with TokenizerFunc = boost::char_delimiters_separator<char,
std::char_traits<char> >, Iterator = __gnu_cxx::__normal_iterator<const
char*, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> >, Type = std::basic_string<char, std::char_traits<char>,
std::allocator<char> >]: Assertion `valid_' failed.

I expected it to throw some descendant of a standard exception instead. Is
it indeed the accepted policy in the Date_time library to always handle
invalid input data by throwing an appropriate exception? Or are there
cases where the input is intentionally assumed to be correct and is thus
left unchecked?

Thanks in advance!

 -- Alexander

Boost list run by bdawes at, gregod at, cpdaniel at, john at