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++/25995] New: switch/case does not detect invalid enum values if default-case is used


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


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