The example provided in [module.global] p2 contains three function template definitions with return type int, but none of them returns a value:
// N::f is reachable via argument-dependent name lookup result
// in context of template definition
template<typename T> int use_f() { N::X x; f(x); }
// N::g is not reachable because g is a dependent name
// in context of template definition
template<typename T> int use_g() { N::X x; g((T(), x)); }
// N::h is reachable because use_h<int> has a point of
// instantiation in the module unit M
template<typename T> int use_h() { N::X x; h((T(), x)); }
The obvious fix is to add a return before the corresponding function calls of f, g, and h.
The example provided in [module.global] p2 contains three function template definitions with return type
int
, but none of them returns a value:The obvious fix is to add a
return
before the corresponding function calls off
,g
, andh
.