https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33911

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=84347

--- Comment #19 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Elias Pipping from comment #18)

In my view (while working on some fixes in this area), deprecating a primary
template is a request to diagnose all uses of the template-id, including
declarations of partial specializations and explicit specializations.  The way
to achieve the effect you are looking for is to

1) declare the primary template without deprecated:

  template<bool B, class T = void> struct enable_if;

2) define one partial specialization deprecated:

  template<class T> struct [[deprecated]] enable_if<false, T> {};

3) define the complement of the first partial specialization that's not
deprecated:

  template<class T> struct enable_if<true,T> { };

This should cause uses of the first (deprecated) partial specialization to be
diagnosed.  This is also what Clang does.  GCC doesn't diagnose it because of
bug 84347 but will once the bug is fixed.

Reply via email to