https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61344
Bug ID: 61344
Summary: Wswitch does not work with enum bitfields
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: manu at gcc dot gnu.org
For this testcase:
typedef union tree_node *tree;
enum built_in_function { BUILT_IN_ACOS, BUILT_IN_FPCLASSIFY, BUILT_IN_ISFINITE
};
struct tree_function_decl {
__extension__ enum built_in_function function_code : 11;
};
union tree_node {
struct tree_function_decl function_decl;
};
static tree
convert_arguments (tree fundecl)
{
switch (((fundecl)->function_decl.function_code))
{
case BUILT_IN_ISFINITE:
case BUILT_IN_FPCLASSIFY:
return (tree) 0;
}
return fundecl;
}
clang prints:
test.c:12:11: warning: enumeration value 'BUILT_IN_ACOS' not handled in switch
[-Wswitch]
switch (((fundecl)->function_decl.function_code))
^
but gcc does not print anything with -Wswitch.
This is because it is an enum bitfield.
Related to PR53874.