cplusplus / modules-ts

C++ Modules Technical Specification working draft.
23 stars 7 forks source link

Missing function returns in [module.global] example #2

Closed Dani-Hub closed 5 years ago

Dani-Hub commented 6 years ago

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.