declarations after the member has been explicitly specialized. We already
did this after explicit instantiation definitions; not doing it for
declarations meant that subsequent definitions would see a previous
member declaration with specialization kind "explicit instantiation decl",
which would then happily get overridden.
Fixes PR 6458.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97605
91177308-0d34-0410-b5e6-
96231b3b80d8
// of a template appears after a declaration of an explicit
// specialization for that template, the explicit instantiation has no
// effect.
+ SuppressNew = true;
return false;
case TSK_ExplicitInstantiationDefinition:
template<> struct X0<double>;
template struct X0<double>;
+
+// PR 6458
+namespace test0 {
+ template <class T> class foo {
+ int compare(T x, T y);
+ };
+
+ template <> int foo<char>::compare(char x, char y);
+ template <class T> int foo<T>::compare(T x, T y) {
+ // invalid at T=char; if we get a diagnostic here, we're
+ // inappropriately instantiating this template.
+ void *ptr = x;
+ }
+ extern template class foo<char>;
+ template class foo<char>;
+}