This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19941] New: No warning emitted for nested switch statements.
- From: "dhruvbird at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Feb 2005 18:38:35 -0000
- Subject: [Bug c++/19941] New: No warning emitted for nested switch statements.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When there are many nested switch statements, then the compiler does not
recognize bogus labels such as spelling mistakes like 'delault' instead of
'default', and goes on to generate code. Even with -Wall, no warning is
generated. However these stupidities(spelling mistakes) are recognized and
warnings to that effect are emitted in programs such as these:
#include <cstdlib>
int
main()
{
int r = rand();
int s = 0;
switch (s)
{
case 0:
switch(r)
{
case 1:
s = 2;
break;
case 2:
s = 7;
break;
defauft:
s = 9;
}
default:
r = 9;
}
}
swtest.cpp: In function `int main()':
swtest.cpp:21: warning: label `defauft' defined but not used
-Dhruv.
--
Summary: No warning emitted for nested switch statements.
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dhruvbird at yahoo dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19941