Full name of submitter (unless configured in github; will be published with the issue): Jim X
[temp.inst] p5 says:
Unless a function template specialization is a declared specialization, the function template specialization is implicitly instantiated when the specialization is referenced in a context that requires a function definition to exist or if the existence of the definition affects the semantics of the program.
However, [temp.inst] p10 says:
If a function template or a member function template specialization is used in a way that involves overload resolution, a declaration of the specialization is implicitly instantiated ([temp.over]).
In the case of taking address or calling function, they are all involved by the overload resolution, which means, a function template can merely instantiate its declaration in these cases except that the function's return type is auto. The only rule that requires a function to be defined is [basic.def.odr] p11, however, it's obscure in when
Every program shall contain at least one definition of every function or variable that is odr-used in that program outside of a discarded statement; no diagnostic required.
The implicit instantiation affects the instantiation context, which is only determined by the point of instantiation, so, from this perspective, do we need to treat differently whether the definition or declaration of the function is implicitly instantiated?
In other words, whether the implicit instantiation instantiates the declaration or definition of the function, they do not affect the instantiation context and points of instantiation of the function template.
Full name of submitter (unless configured in github; will be published with the issue): Jim X
[temp.inst] p5 says:
However, [temp.inst] p10 says:
In the case of taking address or calling function, they are all involved by the overload resolution, which means, a function template can merely instantiate its declaration in these cases except that the function's return type is
auto
. The only rule that requires a function to be defined is [basic.def.odr] p11, however, it's obscure in whenThe implicit instantiation affects the instantiation context, which is only determined by the point of instantiation, so, from this perspective, do we need to treat differently whether the definition or declaration of the function is implicitly instantiated? In other words, whether the implicit instantiation instantiates the declaration or definition of the function, they do not affect the instantiation context and points of instantiation of the function template.