lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[3]: [lmi] passing objects instead of references to value_cast


From: Vadim Zeitlin
Subject: Re[3]: [lmi] passing objects instead of references to value_cast
Date: Mon, 2 Jun 2008 11:52:46 +0200

[following up on my own message]

VZ>  Amazingly everything indeed works for me with g++ 3.3, 3.4 and 4.2 but
VZ> with 4.1 many things break and I'm still not sure I understand why even
VZ> though I had already spent a couple of hours on this. I'm also not sure if
VZ> the problem is actually due to the compiler version difference or boost
VZ> version difference but I think it's probably the latter. The trouble is
VZ> that I can use g++ 4.1 with boost 1.33 or g++ 4.2 with boost 1.34 but can't
VZ> test the other combinations easily.

 I did test g++ 4.1 with Boost 1.34 and unfortunately the problem is still
there, so this does look like a compiler bug in g++ 4.1, considering that
the problem doesn't arise with neither previous nor subsequent versions of
the compiler and that error messages are rather nonsensical:

value_cast.hpp: In member function 'To value_cast_chooser<To, From, 1>::
        operator()(const From&) [with To = bool, From = char [2]]':
value_cast.hpp:269:   instantiated from 'To value_cast(const From&)
        [with To = bool, From = char [2]]'
value_cast_test.cpp:721:   instantiated from here
value_cast.hpp:248: error: invalid operands of types 'const char (&)[2]'
         and 'int' to binary 'operator!='

The line numbers in value_cast.hpp are not the same as in the cvs but The
line 721 of the test is unchanged and reads

    BOOST_TEST_EQUAL(true, value_cast<bool>("1"));

and even if I remove BOOST_TEST_EQUAL() and leave just the value_cast, the
error message is the same -- in spite of the fact that there is no
operator!=() anywhere.

VZ> But just in case the problems are indeed shown to be fixed by upgrading
VZ> boost, would this be acceptable or do you want to continue to support
VZ> boost 1.33?

 So this question doesn't need answering any more, switching to 1.34
doesn't solve the problem.

 OTOH I wonder if it's worth trying to work around g++ 4.1 problem if it's
indeed a compiler bug and, moreover, an already fixed one. It seems that
the only thing which doesn't work is value_cast<bool, char []> and there is
an easy workaround (already used by quite a few tests) which is to use
value_cast<bool, std::string> instead. And if I comment this test out, the
test compiles and runs with only a single failure but one which happened
before my modifications too. For the record, the failure is

**** test failed:
'100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
==
'100000000000000003774589324822814887066163651282028976933086588120176268637538771050475113919654290478469527765363729011764432297892058199009821165792668120252416'
[file value_cast_test.cpp, line 331]

I didn't look at it yet but this doesn't look especially good...

 Anyhow, for now the main question is whether I should continue to spend
time on fixing the problem with value_cast<bool, char[]> which happens with
g++ 4.1 (only) or simply disable the test (perhaps for this compiler only)
and continue testing with Comeau and MSVC?

 Thanks,
VZ





reply via email to

[Prev in Thread] Current Thread [Next in Thread]