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++/71274] New: deprecated static const member of struct raises warning without use


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

            Bug ID: 71274
           Summary: deprecated static const member of struct raises
                    warning without use
           Product: gcc
           Version: 6.1.1
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vigerske at math dot hu-berlin.de
  Target Milestone: ---

When compiling the code

struct foo
{
   __attribute__ ((deprecated)) static const int a;
};

with GCC 6.1.1 (g++), it raises a deprecated-declaration warning:

dep.cpp:1:8: warning: âfoo::aâ is deprecated [-Wdeprecated-declarations]
 struct foo
        ^~~
dep.cpp:3:50: note: declared here
    __attribute__ ((deprecated)) static const int a;


This is unexpected to me, as the documentation says that "The deprecated
attribute results in a warning if the variable is used anywhere in the source
file.". But it is not used anywhere.

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