while searching clues compilation problem have had in source, have come across bug report (against mozilla's javascript engine source) related functions lookup. quoting bug report:
typedarraytemplate (obviously) template, , referencing int_to_jsval, static inline function, without prefixing "::". breaks xlc because can not resolve int_to_jsval. standard not require statics considered if unqualified name not found in context of template arguments. g++ fallback, xlc not.
informative message compiler:
(i) static declarations not considered function call if function not qualified.
in case code failing similar this:
namespace n { static bool foo (std::string const &); template <typename t> void bar (t const &, std::string const & s) { // expected unqualified call n::foo() foo (s); } void baz (std::string const & s) { bar (s); } } // namespace n
is behaviour xlc implements correct? 2003 or 2011 standard talk this?
prior c++11 correct behavior: unqualified name resolution of names used in templates defined find functions external linkage.
c++03 section 14.6.4.2 candidate functions [temp.dep.candidate] paragraph 1:
for function call depends on template parameter, if function name unqualified-id not template-id, candidate functions found using usual lookup rules (3.4.1, 3.4.2) except that:
for part of lookup using unqualified name lookup (3.4.1), function declarations external linkage template definition context found.
for part of lookup using associated namespaces (3.4.2), function declarations external linkage found in either template definition context or template instantiation context found.
which changes in c++11 to:
for function call depends on template parameter, candidate functions found using usual lookup rules (3.4.1, 3.4.2, 3.4.3) except that:
for part of lookup using unqualified name lookup (3.4.1) or qualified name lookup (3.4.3), function declarations template definition context found.
for part of lookup using associated namespaces (3.4.2), function declarations found in either template definition context or template instantiation context found.
Comments
Post a Comment