inaddr.cpp: In method `void cc_InetAddress::setAddress(const char *)':
inaddr.cpp:232: ambiguous overload for `cc_InetAddress & = unsigned int'
inaddr.cpp:109: candidates are: class cc_InetAddress & cc_InetAddress::operator =(const char *)
inaddr.cpp:137: class cc_InetAddress & cc_InetAddress::operator =(const cc_InetAddress &)
inaddr.cpp:128: class cc_InetAddress & cc_InetAddress::operator =(long unsigned int)
make: *** [inaddr.lo] Error 1
----
There seem to be two problems.
The first, most obvious one, is a type-conversion error. On that version of Solaris, the function htonl() returns "uint32_t" which is typedef'ed to be "unsigned int", but the operator=() wants a "long unsigned int".
The second problem is that on Solaris, the function htonl() can actually be defined to be a null function:
This may not be a big deal (since from surrounding comments in the code I gather that this bit of it may not be that important) ... but I figured I'd post this anyway in case the project admins want to do something with it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
On my Solaris (SunOS 5.7) box:
> uname -a
SunOS ocr1 5.7 Generic_106541-12 sun4u sparc SUNW,Ultra-2
> g++ --version
2.95.2
For posix/inaddr.cpp, line 232:
*this = htonl(INADDR_ANY);
I get the following error (editted for post):
c++ -DHAVE_CONFIG_H -I. -I. -I. -I../posix -g -O2 -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -c -fPIC -DPIC inaddr.cpp -o .libs/inaddr.lo
inaddr.cpp: In method `void cc_InetAddress::setAddress(const char *)':
inaddr.cpp:232: ambiguous overload for `cc_InetAddress & = unsigned int'
inaddr.cpp:109: candidates are: class cc_InetAddress & cc_InetAddress::operator =(const char *)
inaddr.cpp:137: class cc_InetAddress & cc_InetAddress::operator =(const cc_InetAddress &)
inaddr.cpp:128: class cc_InetAddress & cc_InetAddress::operator =(long unsigned int)
make: *** [inaddr.lo] Error 1
----
There seem to be two problems.
The first, most obvious one, is a type-conversion error. On that version of Solaris, the function htonl() returns "uint32_t" which is typedef'ed to be "unsigned int", but the operator=() wants a "long unsigned int".
The second problem is that on Solaris, the function htonl() can actually be defined to be a null function:
(from /usr/include/sys/byteorder.h)
#define htonl(x) (x)
which will cause the line to actually be:
*this = ((INADDR_ANY));
which (again) ends up trying to give an "unsigned int" to the operator=().
The (simple) fix I made for both of these problems is the following:
> diff inaddr.cpp.orig inaddr.cpp
232c232
< *this = htonl(INADDR_ANY);
---
> *this = (long unsigned int)htonl(INADDR_ANY);
This may not be a big deal (since from surrounding comments in the code I gather that this bit of it may not be that important) ... but I figured I'd post this anyway in case the project admins want to do something with it.
Done for 1.3.2.