You're right.
Only WRT some limited points, but probably not in general :)
It works because the base classes of T are "associated" in:
struct myclass : X<myclass> {};
I think the OP asked about explicit instantiated X<myclass>. Daniel (Spangenberg), please correct me if I'm wrong, but you question boils down to something like this:
namespace A { template< typename T > struct X { friend void operator+(T,T) {} }; }
namespace B { struct Y {}; template struct A::X< Y >; // explicit instantiation }
int main() { B::Y a; B::Y b;
a + b; // <-- ?? }
The above code compiles fine with the GCC 2.95.2. The GCC 3.3 doesn't find the operator (it injects it into A, not into B), the Comeau rejects the explicit instantiation. Initially I thought that the above example should be legal, as the standard reads in 14.6.5/1:
"When a template is instantiated, the names of its friends are treated as if the specialization had been explicitly declared at its point of instantia-tion."
The point of instantiation is in namespace B, but after thinking about it a bit longer and reading some more stuff from the standard, I wonder if this can be true. The instantiation could happen in a different translation unit, so it seems strange that the operator is found in the same translation unit but not in different ones. Also, the Comeau rejects the explicit instantiation as it happens inside the namespace. 14.7.2 is also pretty clear on the subject, so I think that the GCC 3.3 is correct, the Comeau should probably turn the error into a warning as the instantiation is not illegal (AFAICS, but correct me if I'm wrong), but probably has surprising behaviour. The GCC 2.95.2 and the operators library is wrong, the OP's observation is correct that it uses non-standard code. Also, I need to understand why my reading of 14.6.5/1 is wrong, or is this a DR? Should I take it to csc++?
Regards, Daniel
-- Daniel Frey
aixigo AG - financial training, research and technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: [EMAIL PROTECTED], web: http://www.aixigo.de
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost