Sun C++ 5.1 is ages old. IIRC, the first version of Sun C++ after
5.0 that an old version of the library was ported to (2.2?) with
some success was 5.2 or perhaps even later. The problem is unlikely
to be in stdcxx but rather in the compiler itself.

If you must stay with this old compiler then your solution looks
okay to me:

  if (!bool(__errtmp) &&  0 == __sizes [0]

Alternatively, you can try comparing it for equality to __rw_goodbit
(that, I think, would be strictly speaking more correct, although
the end result is the same as __rw_goodbit's value is zero):

  if (__errtmp !=  _RW::__rw_goodbit &&  0 == __sizes [0]

Martin

On 04/06/2010 03:41 PM, Bailey, Kendall wrote:
I'm seeing an odd compile error when building edition 11 of RogueWave Tools on 
Solaris 10, using Sun C++ 5.1 and Apache stdcxx 4.2.1.


=======================================
Here's the compile command and error:
=======================================

$ CC -m64 -library=%none -I/opt/oss/stdcxx/include -D_RWCONFIG=15d -I./../../.. 
-I.. -D_RWBUILD_tls -c -errtags -mt -PIC -xldscope=hidden -g ../ansilocale.cpp


"/opt/oss/stdcxx/include/loc/_time_get.cc", line 218: Error, badbinaryop: The operation 
"RWBitVec&&  bool" is illegal.

"/opt/oss/stdcxx/include/loc/_locale.h", line 347:     Where, temwhileinst: While instantiating "std::time_get<char, 
std::istreambuf_iterator<char, std::char_traits<char>>>::do_get(std::istreambuf_iterator<char, std::char_traits<char>>, 
std::istreambuf_iterator<char, std::char_traits<char>>, std::ios_base&, __rw::__rw_iostate&, std::tm*, char, char) const".

"/opt/oss/stdcxx/include/loc/_locale.h", line 347:     Where, teminstend: 
Instantiated from non-template code.

"/opt/oss/stdcxx/include/loc/_time_get.cc", line 350: Error, badbinaryop: The operation 
"RWBitVec&&  std::tm*" is illegal.

"/opt/oss/stdcxx/include/loc/_locale.h", line 347:     Where, temwhileinst: While instantiating "std::time_get<char, 
std::istreambuf_iterator<char, std::char_traits<char>>>::do_get(std::istreambuf_iterator<char, std::char_traits<char>>, 
std::istreambuf_iterator<char, std::char_traits<char>>, std::ios_base&, __rw::__rw_iostate&, std::tm*, char, char) const".

"/opt/oss/stdcxx/include/loc/_locale.h", line 347:     Where, teminstend: 
Instantiated from non-template code.

2 Error(s) detected.


=======================================
The code at line 218 of _time_get.cc looks like this:
=======================================
      if ( !__errtmp&&  0 == __sizes [0]

I have tried various things and found that the __errtmp is a scalar, but once the ! 
is applied, it becomes a RWBitVec.  I can only conclude that the compiler is doing 
an unnecessary implicit conversion:  first applying the RWBitVec(size_t N) 
constructor and then the operator!(RWBitVec&  ) friend function.

If I explicitly convert the operand of the unary ! to a bool first, then all 
compiles nicely.  Is this an appropriate change to make in Apache stdcxx?  Is 
the error a result of a compiler bug?  I changed the half dozen similar errors 
I ran into like so:

      if ( !bool(__errtmp)&&  0 == __sizes [0]


Would it be more correct to use (__errtmp == 0) ?  My attempts to create a 
small test case that triggers a similar error have failed.  Only the full 
ansilocale.cpp in the RogueWave tools library has triggered this problem.  I 
can provide a complete patch file for the changes I had to make if that's 
helpful.

-------------------------------------------------
Kendall Bailey



Reply via email to