[optional] New implementation of boost/none.hpp hits Borland 5.6.4 bug

Hallo, unfortunately the recently committed changes to Boost.Optional uncover a bug in BCB6, i.e. borland 5.6.4 . As 1.34 is going to be the last Boost release to officially support this compiler, it would be very important to fix this problem before the release. I see that currently no tester is running tests for borland 5.6.4; if none is available I could run the tests locally on my machine and report back or, with a little hand-holding, run a full regression run. The bug can be observed by compiling the following very simple source file: #include <boost/optional.hpp> #include <sstream> This result in a rather incomprehensible error message: [C++ Error] _ctype.h(124): E2034 Cannot convert 'int *' to 'const ctype_base::mask *' The problem appears to be triggered by the relational operator overloads that take a none_t as a first argument (don't ask me why!). By commenting out lines 838-866 in boost/optional/optional.hpp the problem disappears. The only workaround I was able to find is to revert to the previous implementation of boost/none.hpp, as in the following: #include <boost/detail/workaround.hpp> namespace boost { #if ! BOOST_WORKAROUND(__BORLANDC__, <= 0x564) namespace detail { struct none_helper{}; } typedef int detail::none_helper::*none_t ; none_t const none = ((none_t)0) ; #else enum none_t {none = 0}; #endif } // namespace boost Given this is such a simple header it may be reasonable not to include boost/detail/workaround.hpp here and explicitly state the condition. Note that this problem is not present in borland 5.8.2. Cheers, Nicola Musatti

Nicola Musatti <Nicola.Musatti <at> gmail.com> writes: [...]
#include <boost/detail/workaround.hpp>
namespace boost {
#if ! BOOST_WORKAROUND(__BORLANDC__, <= 0x564) ^ Oops! There's an extra exclamation mark I left over after testing.
Cheers, Nicola Musatti

Hallo Nicola,
Hallo, unfortunately the recently committed changes to Boost.Optional uncover a bug in BCB6, i.e. borland 5.6.4 . As 1.34 is going to be the last Boost release to officially support this compiler, it would be very important to fix this problem before the release.
What a compiler error o) I'm glad you uncover it.
The only workaround I was able to find is to revert to the previous implementation of boost/none.hpp, as in the following:
OK. That will prevent "none.hpp" and hence "optional.hpp" to be put in a precompiled header, but I guess that's better than a compiler error. If Thomas gives me a green light I'll commit it.
Given this is such a simple header it may be reasonable not to include boost/detail/workaround.hpp here and explicitly state the condition.
I like the macro better since it follows the BOOST_STRICT_CONFIG alternative.
Note that this problem is not present in borland 5.8.2.
OK Thank you for the patch. Best Fernando

Fernando Cacciola <fernando_cacciola <at> hotmail.com> writes:
Fernando Cacciola wrote:
If Thomas gives me a green light I'll commit it.
Got and committed.
Thank you! Cheers, Nicola Musatti

Fernando Cacciola wrote:
Fernando Cacciola wrote:
If Thomas gives me a green light I'll commit it.
Got and committed.
Fernando, I'm afraid you made a mistake: #if BOOST_WORKAROUND(_BORLANDC_, <= 0x564) ^ ^ There should be two underscores both before and after BORLANDC. Cheers, Nicola Musatti

Nicola Musatti wrote:
Fernando Cacciola wrote:
Fernando Cacciola wrote:
If Thomas gives me a green light I'll commit it.
Got and committed.
Fernando, I'm afraid you made a mistake:
#if BOOST_WORKAROUND(_BORLANDC_, <= 0x564) ^ ^ There should be two underscores both before and after BORLANDC.
Ouch. Actually I knew that... but I copy-pasted the code from the post o) Fixed now. Fernando
participants (2)
-
Fernando Cacciola
-
Nicola Musatti