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++/81250] New: C++ warnings about unused stl


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

            Bug ID: 81250
           Summary: C++ warnings about unused stl
           Product: gcc
           Version: 5.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jg at jguk dot org
  Target Milestone: ---

Created attachment 41649
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41649&action=edit
To reproduce

Noticed that std::string which are unused, don't generate warnings. Could these
be detected?

g++ -Wall -Wunused-variable -o main main.cpp

Attached is an example.

Expected output:
main.cpp:12: warning: unused variable ‘unused_str’ [-Wunused-variable]
     string unused_str;

main.cpp:17: warning: unused variable ‘unused_var’ [-Wunused-variable]
     string unused_var;



NOTE:

If I add an unused size_t, I do get a warning.
main.cpp:13:12: warning: unused variable ‘no’ [-Wunused-variable]
     size_t no = 0;

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