This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/84347] New: attribute deprecated on a class partial specialization has no effect


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

            Bug ID: 84347
           Summary: attribute deprecated on a class partial specialization
                    has no effect
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

G++ diagnoses uses of a specialization of a primary class or variable template
declared deprecated but it fails to diagnose uses of a partial specialization
of a class template declared deprecated.

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

A<int> aci;         // -Wdeprecated-declarations (good)

template <class T> int V;
template <class T> int __attribute__ ((deprecated)) V<T*>;

void f ()
{
  (void)V<int>;     // no warning (good)
  (void)V<int*>;    // -Wdeprecated-declarations (good)
}

template <class T> struct B { };
template <class T> struct __attribute__ ((deprecated)) B<T*> { };

B<int> bi;          // no warning (good)
B<int*> bpi;        // missing -Wdeprecated-declarations
t.C:3:1: warning: ‘template<class T> struct A’ is deprecated
[-Wdeprecated-declarations]
 A<int> aci;         // -Wdeprecated-declarations (good)
 ^
t.C:1:56: note: declared here
 template <class T> struct __attribute__ ((deprecated)) A { };
                                                        ^
t.C: In function ‘void f()’:
t.C:11:9: warning: ‘V<int*>’ is deprecated [-Wdeprecated-declarations]
   (void)V<int*>;    // -Wdeprecated-declarations (good)
         ^~~~~~~
t.C:6:53: note: declared here
 template <class T> int __attribute__ ((deprecated)) V<T*>;
                                                     ^~~~~

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]