This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug pending/64214] New: no warning for unused global
- From: "jg at jguk dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 07 Dec 2014 21:09:05 +0000
- Subject: [Bug pending/64214] New: no warning for unused global
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64214
Bug ID: 64214
Summary: no warning for unused global
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: pending
Assignee: unassigned at gcc dot gnu.org
Reporter: jg at jguk dot org
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
$ g++ -O -Wunused-variable -Werror -Wall -o main gcc_unused.cpp
compiles ok. I had expected it to report the unused global variable:
bool glob = false;
int main()
{
return 0;
}
if I make the global "static" gcc does report :
gcc_unused.cpp:3:13: error: âglobâ defined but not used
[-Werror=unused-variable]
However, could gcc report even when it is not static?
Thank you for considering this.