当我在搜索有关我的源代码中的编译问题的线索时,我遇到了与函数查找相关的错误报告(针对Mozilla的JavaScript引擎源代码).引用错误报告:
TypedArrayTemplate(显然)是一个模板,它引用了静态内联函数INT_TO_JSVAL,没有用"::"作为前缀.这会破坏xlC,因为它无法解析INT_TO_JSVAL.如果在模板参数的上下文中找不到非限定名称,则标准不要求考虑静态.g ++做这个后备,xlC没有.
来自编译器的信息性消息:
(I) Static declarations are not considered for a function call if the function is not qualified.
Run Code Online (Sandbox Code Playgroud)
在我的情况下,失败的代码与此类似:
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
Run Code Online (Sandbox Code Playgroud)
xlC实现的行为是否真的正确?2003或2011标准在哪里谈到这一点?