https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92413
Bug ID: 92413
Summary: [temp.explicit] Explicit template instantiations
should not define member functions that are not
defined at the point of instantiation
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: i at maskray dot me
Target Milestone: ---
https://wg21.cmeerw.net/cwg/issue546
Change 17.8.2 [temp.explicit] paragraph 8 as follows:
An explicit instantiation definition that names a class template specialization
explicitly instantiates the class template specialization and is only an
explicit instantiation definition of members <del>whose definition is
visible></del><strong>that have been defined</strong> at the point of
instantiation.
template <class T> struct C {void foo();};
template struct C<int>;
template <class T> void C<T>::foo() {}
GCC<4.9 does not define C<int>::foo(), while GCC>=4.9 defines C<int>::foo()
I am not sure whether this example is non-conforming, but -Wall -Wextra
-pedantic gives no diagnostic. (clang 3.0~trunk does not define C<int>::foo().
You may read the discussions at https://bugs.llvm.org/show_bug.cgi?id=43937)