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