public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104142] New: [9/10/11/12] Spurios warning unused-variable
@ 2022-01-20  8:42 phdiv at fastmail dot fm
  2022-01-20  8:48 ` [Bug c++/104142] " rguenth at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: phdiv at fastmail dot fm @ 2022-01-20  8:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104142
           Summary: [9/10/11/12] Spurios warning unused-variable
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: phdiv at fastmail dot fm
  Target Milestone: ---

Created attachment 52238
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52238&action=edit
Reproducer.

> cat c.cpp
struct A { };
static const A a;

struct B { B()=default; };
static const B b;


> g++ -Wunused-variable -Wunused-const-variable -c c.cpp
c.cpp:5:16: warning: 'b' defined but not used [-Wunused-variable]
    5 | static const B b;
      |                ^
c.cpp:2:16: warning: 'a' defined but not used [-Wunused-const-variable=]
    2 | static const A a;
      |                ^


I would expect the warning unused-const-variable to be issued for both a and b.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-07-07  9:55 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20  8:42 [Bug c++/104142] New: [9/10/11/12] Spurios warning unused-variable phdiv at fastmail dot fm
2022-01-20  8:48 ` [Bug c++/104142] " rguenth at gcc dot gnu.org
2022-01-21  8:32 ` [Bug c++/104142] [9/10/11/12 Regression] Spurios warning unused-variable on const static variable and defaulted constructor pinskia at gcc dot gnu.org
2022-01-28 11:32 ` jakub at gcc dot gnu.org
2022-01-28 11:43 ` jakub at gcc dot gnu.org
2022-04-11 18:52 ` jason at gcc dot gnu.org
2022-04-12  3:58 ` cvs-commit at gcc dot gnu.org
2022-05-04  2:36 ` [Bug c++/104142] [9/10/11 Regression] Spurious " mh+gcc at glandium dot org
2022-05-04  3:26 ` mh+gcc at glandium dot org
2022-05-12 20:13 ` cvs-commit at gcc dot gnu.org
2022-05-12 21:25 ` [Bug c++/104142] [9/10 " cvs-commit at gcc dot gnu.org
2022-05-27  9:47 ` [Bug c++/104142] [10 " rguenth at gcc dot gnu.org
2022-06-28 10:47 ` jakub at gcc dot gnu.org
2023-07-07  9:55 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).