[Bug c++/93228] New: [[deprecated("message")]] on template struct/class drops message

phdofthehouse at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jan 10 16:25:00 GMT 2020


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

            Bug ID: 93228
           Summary: [[deprecated("message")]] on template struct/class
                    drops message
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: phdofthehouse at gmail dot com
  Target Milestone: ---

Godbolt: https://godbolt.org/z/tBd8Ce

Inline minimal repro:
-----------------------------------------
template <typename T>
struct [[deprecated("foo")]] bar {}; 

struct [[deprecated("baz")]] baz {}; 

int main () {

    bar<int> b;
    baz c;
}
------------------------------------------

Output:
------------------------------------------
<source>: In function 'int main()':

<source>:8:5: warning: 'template<class T> struct bar' is deprecated
[-Wdeprecated-declarations]

    8 |     bar<int> b;

      |     ^~~

<source>:2:30: note: declared here

    2 | struct [[deprecated("foo")]] bar {};

      |                              ^~~

<source>:9:9: warning: 'baz' is deprecated: baz [-Wdeprecated-declarations]

    9 |     baz c;

      |         ^

<source>:4:30: note: declared here

    4 | struct [[deprecated("baz")]] baz {};

      |                              ^~~

ASM generation compiler returned: 0

<source>: In function 'int main()':

<source>:8:5: warning: 'template<class T> struct bar' is deprecated
[-Wdeprecated-declarations]

    8 |     bar<int> b;

      |     ^~~

<source>:2:30: note: declared here

    2 | struct [[deprecated("foo")]] bar {};

      |                              ^~~

<source>:9:9: warning: 'baz' is deprecated: baz [-Wdeprecated-declarations]

    9 |     baz c;

      |         ^

<source>:4:30: note: declared here

    4 | struct [[deprecated("baz")]] baz {};

      |                              ^~~
------------------------------------------


Message is dropped. Probably just a corner case not considered.


More information about the Gcc-bugs mailing list