This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81250] New: C++ warnings about unused stl
- From: "jg at jguk dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 29 Jun 2017 12:40:15 +0000
- Subject: [Bug c++/81250] New: C++ warnings about unused stl
- Auto-submitted: auto-generated
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;