This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/25995] New: switch/case does not detect invalid enum values if default-case is used
- From: "sven dot bornemann at materna dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Jan 2006 13:10:52 -0000
- Subject: [Bug c++/25995] New: switch/case does not detect invalid enum values if default-case is used
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code is compiled without warnings, in spite of 4711 not being
defined by enum. If the default-case will be omitted, the expected warning
appears.
int main(int argc, char** argv)
{
enum Enum { a };
Enum test = a;
switch(test)
{
case 4711:
break;
default:
break;
}
return 0;
}
--
Summary: switch/case does not detect invalid enum values if
default-case is used
Product: gcc
Version: 4.0.1
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sven dot bornemann at materna dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25995