Bug ID: 84318
           Summary: attribute deprecated on function templates different
                    than class templates
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot
          Reporter: msebor at gcc dot
  Target Milestone: ---

When a primary class template is declared deprecated, GCC will issue
-Wdeprecated-declarations for declarations of explicit specialization of the
template.  However, when a primary function template is declared deprecated,
GCC accepts declarations of its explicit specializations with no warning.  Both
kinds of declarations should be treated the same (and I'd say both should
trigger a warning).

$ cat t.C && gcc -S -Wall t.C
template <class T>
struct __attribute__ ((deprecated ("class")))
S { };

template <>
struct S<void> { };   // -Wdeprecated-declarations (good)

template <class T>
void __attribute__ ((deprecated ("function")))
foo ();

template <>
void foo<void> ();   // missing -Wdeprecated-declarations (bug)
t.C:6:8: warning: ‘template<class T> struct S’ is deprecated
 struct S<void> { };
t.C:3:1: note: declared here
 S { };

Reply via email to