While I was searching for clues about a compilation problem I have had in my source, I have come across this bug report (against Mozilla's JavaScript engine source) related to functions lookup. Quoting from the bug report:
TypedArrayTemplate is (obviously) a template, and it is referencing INT_TO_JSVAL, a static inline function, without prefixing it with "::". This breaks xlC because it can not resolve INT_TO_JSVAL. The standard does not require that statics be considered if the unqualified name is not found in the context of the template arguments. g++ does this fallback, xlC does not.
Informative message from the compiler:
(I) Static declarations are not considered for a function call if the function is not qualified.
In my case the code that was failing was similar to this:
namespace N
{
static bool foo (std::string const &);
template <typename T>
void bar (T const &, std::string const & s)
{
// expected unqualified call to N::foo()
foo (s);
}
void baz (std::string const & s)
{
bar (s);
}
} // namespace N
Is the behaviour that xlC implements really correct? Where does the 2003 or 2011 standard talk about this?