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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-03-17
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1
      Known to fail|                            |4.6.0, 5.3.0, 6.3.0, 7.0

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
I'll confirm this bug.  The manual seems clear that 

 "the warnings only occur for uses and then only if the type is being applied
to an identifier that itself is not being declared as deprecated."

With today's top of trunk I get the same output:

$ cat t.C && gcc -S -Wall -Wextra -xc t.C
#define Deprecated __attribute__((deprecated))

typedef int INT Deprecated;   // no warning (ok)

typedef INT FOO Deprecated;   // no warning (ok)

struct Deprecated S {
  INT i;                      // warning (bug?)
};

INT f1 (void) Deprecated;     // no warning (ok)

void f2 (INT) Deprecated;     // warning (bug)

INT f3 (INT) Deprecated;      // warning (bug)

INT i Deprecated;             // no warning (ok)
t.C:8:3: warning: ‘INT’ is deprecated [-Wdeprecated-declarations]
   INT i;                      // warning (bug?)
   ^~~
t.C:13:1: warning: ‘INT’ is deprecated [-Wdeprecated-declarations]
 void f2 (INT) Deprecated;     // warning (bug)
 ^~~~
t.C:15:1: warning: ‘INT’ is deprecated [-Wdeprecated-declarations]
 INT f3 (INT) Deprecated;      // warning (bug)
 ^~~


G++ comes closer to the expected output but it fails the typedef test (which
GCC passes in C mode):

t.C:8:7: warning: ‘INT’ is deprecated [-Wdeprecated-declarations]
   INT i;                      // warning (bug?)
       ^
t.C:3:13: note: declared here
 typedef int INT Deprecated;   // no warning (ok)
             ^~~

Clang 5.0 produces no warnings.

Reply via email to