This question arised in the context of this answer.
As I would expect, this translation unit does not compile:
template int getNum()
Eureka! I finally fall on the relevant paragraph, [temp.spec]/5
For a given template and a given set of template-arguments,
(5.1) an explicit instantiation definition shall appear at most once in a program,
(5.2) an explicit specialization shall be defined at most once in a program, as specified in [basic.def.odr], and
- (5.3) both an explicit instantiation and a declaration of an explicit specialization shall not appear in a program unless the explicit instantiation follows a declaration of the explicit specialization.
An implementation is not required to diagnose a violation of this rule.
So explicit template instantiation definition (not implicit instantiation) can cause ODR violation, no diagnostic required (and at least gcc and clang - ld toolchains do not produce diagnostic)