#3076 closed Bugs (fixed)
[multi_index] assertion failure sorting an empty collection in VC10 Beta 1
Reported by: | Owned by: | Joaquín M López Muñoz | |
---|---|---|---|
Milestone: | Boost 1.40.0 | Component: | multi_index |
Version: | Boost 1.38.0 | Severity: | Problem |
Keywords: | Cc: |
Description
The Bimap 'test_bimap_sequenced' test is failing in VC10 beta due to an assertion failure (http://tinyurl.com/qwczko), but the actual problem seems to be in multi_index.
When you run the sample:
using namespace boost::multi_index; typedef multi_index_container< std::string, indexed_by< random_access<> > > text_container; int _tmain(int argc, _TCHAR* argv[]) { text_container tc; tc.sort(); return 0; }
the call to std::copy on line 190 of rnd_index_ops.hpp passes NULL as the third parameter (&*buf). The VC10 version of copy asserts if the 3rd param is NULL, causing the failure.
Change History (4)
comment:1 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 13 years ago
Hi Richard,
Thanks for reporting this bug. I've just commited a fix:
https://svn.boost.org/trac/boost/changeset/53246
I'd appreciate if you can have keep an eye on this to make sure the problems in bimap eventually disappear.
There's one thing in your description of the problem that puzzles me a bit: you say that std::copy asserts because the third parameter is NULL, yet it seems to me that it's entirely ok to invoke
std::copy(first,last,NULL);
as long as first==last and consequently NULL is not dereferenced. Can you provide me with more info on the kind of assertion failure you're seeing? Can't it rather be the expression &*buf that is failing?
comment:3 by , 13 years ago
In VC9, the copy code does the check
_DEBUG_RANGE(_First, _Last); if (_First != _Last)
_DEBUG_POINTER(_Dest);
Wheras VC10 just does
_DEBUG_RANGE(_First, _Last); _DEBUG_POINTER(_Dest);
(Where _DEBUG_POINTER gives an error if _Dest is NULL). So VC9 only complains if Dest is null and theres something to do, but VC10 gives you an error any time it's null.
comment:4 by , 13 years ago
I see. I'm not entirely sure the VC10 checking is conformant, so I've posted a query to comp.std.c++:
Let's see what the gurus say.
(In [53246]) fixed #3076