This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118f. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-11-07
Consider:
template<typename T>
struct S {
static constexpr bool value = false;
};
template<typename T>
struct [[deprecated]] S<const T> {
static constexpr bool value = true;
};
static_assert(S<const int>::value, "BOOM!");
Should this trigger the deprecation warning for using the partial specialization? There is implementation divergence.
One consistent approach (used by clang) is to instantiate a declaration of the specialization from the primary template, but to instantiate the definition from the applicable partial specialization. Thus, [[deprecate]] on a partial specialization comes into effect when its definition is instantiated. However, C++ has some situations where a definition is surprisingly required, e.g.:
void f(...);
template<typename T>
struct S {
static constexpr bool value = false;
};
template<typename T>
struct [[deprecated]] S<const T> {
static constexpr bool value = true;
};
S<const int> *p;
void g() { f(p); }