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

            Bug ID: 61754
           Summary: [C++1y] [[deprecated]] attribute warns annoyingly
                    compared to __attribute__((deprecated))
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daniel.kruegler at googlemail dot com

The following code, compiled with 4.10.0 20140707 (experimental) using the
compiler settings:

-Wall -Wextra -std=c++1y -pedantic

//-----------------
struct __attribute__((deprecated)) Old1 {};

Old1 old1 __attribute__((deprecated));

struct [[deprecated]] Old2 {};

Old2 old2 [[deprecated]]; // ##

int main() {}
//-----------------

produces a warning on the line marked with ##:

"warning: 'Old2' is deprecated (declared at prog.cc:5)
[-Wdeprecated-declarations] 
 Old2 old2 [[deprecated]]; 
                        ^"

Note that the corresponding example using type Old1 does not so. Is the
difference in behaviour intended? I'm pretty sure that either variant is
conforming, but this has the effect that it makes [[deprecated]] much less
attractive in real-world code bases.

Please let me know whether the difference is due to your reading of the
standard, in this case I would like to submit a core language issue to make the
wording clearer for such situations.

Reply via email to