
* Is this gcc error correct? Revising a bit ADL + template issues (a fairly complicated logic that should be removed from C++, in my opinion) I think that gcc is right.
Questionable. The problem is that for static_pointer_cast<int> to be valid, static_pointer_cast must be known to be a template. It is understandable why g++ rejects it without a declaration, but I'm not sure whether this is conforming now, much less whether it'd be conforming tomorrow if there are open core issues for this case.
I think I should post this to c.s.c++ to see if this call should kick ADL. If so, I will report a bug to the gcc mailing list. Anyway, static_pointer_cast is not a portable ADL function in Boost. What should we do? Declare an overload taking an additional dummy parameter to deduce the return type? template<class Source, class Target> smart_ptr<Target> static_pointer_cast (const smart_ptr<Source> &s, const Target &); so that the ADL call is: Pointer p; IntPtr ip = static_pointer_cast(p, int()); Meanwhile, I would need to predeclare static_pointer_cast in the Interprocess/Shmem headers for Interprocess/Shmem smart pointer types to make the code work in gcc, but static_pointer_cast is broken for ADL in Boost and that's bad news. Regards, Ion