On Wed, 2007-11-07 at 23:18 +1300, Amos Jeffries wrote: > > Further, I've tried to build 3.0RC1 with SunStudio12 but it > complains about operator overloading when building Squid's 3.0 RC1 > like so: > > > > CC: Warning: Option -fhuge-objects passed to ld, if ld is invoked, ignored otherwise > > "HttpRequestMethod.h", line 138: Error: Overloading ambiguity between > "operator!=(const HttpRequestMethod&, const _method_t&)" and "operator!=(int, int)". > > 1 Error(s) detected. > > *** Error code 1 > > make: Fatal error: Command failed for target `cf_gen.o' > > Current working directory /export/home/randy/Download/squid-3.0.RC1/src > > This second looks like a compiler issue. > Somehow its not registering types properly in its symbol tables. It's > confusing ptr with int, and even appears to be screwing the const > correctness over (the error is for constptr-to-data, where the squid > code contains ptr-to-constdata. Two very different types in C++). This might be a Squid bug. I am not an expert on this, but I am not surprised that GCC is confused by the halfway migration from method_t enum to HttpRequestMethod class. There are no pointers involved here. The global "!=" operator on line 138 provides comparison between a [reference to] HttpRequestMethod and a method_t. There is also a constructor that can create an HttpRequestMethod from a method_t. Method_t is an enum, so it is treated like an int in many contexts. Thus, when we write "5 != 6", GCC may not know whether he is supposed to create an HttpRequestMethod from 5 and method_t from 6 to use the custom operator or just go with the built-in operator for integer comparison. Remove the global operator != at line 138 of HttpRequestMethod.h and Squid may compile. It does in my test, but I did not have the above problem to start with so YMMV. Please keep me posted as I would like to commit this fix if it works for you. Thank you, Alex.