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++/80332] New: Warning is issued for deprecated "using" type alias of deprecated type


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

            Bug ID: 80332
           Summary: Warning is issued for deprecated "using" type alias of
                    deprecated type
           Product: gcc
           Version: 6.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: freddie_chopin at op dot pl
  Target Milestone: ---

There is a base type with "__attribute__ ((deprecated))". If I create an alias
with "typedef", which also has "__attribute__ ((deprecated))", no warning is
issued, which matches the official docs:

https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#Common-Type-Attributes

However if I create a C++11 type alias with "using" keyword, which also has
"__attribute__ ((deprecated))", then the warning is issued for the line with
type alias.

I would expect that it would work the same way as deprecated "typedef", so no
warning.

Code:

-- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 --

typedef int Integer __attribute__ ((deprecated));
using Using __attribute__ ((deprecated)) = Integer;
typedef Integer Typedef __attribute__ ((deprecated));

-- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 --

Test:

-- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 --

$ g++ -c depr.cpp 
depr.cpp:2:44: warning: ‘Integer’ is deprecated [-Wdeprecated-declarations]
 using Using __attribute__ ((deprecated)) = Integer;
                                            ^~~~~~~
depr.cpp:1:13: note: declared here
 typedef int Integer __attribute__ ((deprecated));
             ^~~~~~~

-- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 --

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