diff options
Diffstat (limited to 'gcc/c-parse.y')
-rw-r--r-- | gcc/c-parse.y | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/c-parse.y b/gcc/c-parse.y index aba326d02b9..4f0b1afe97c 100644 --- a/gcc/c-parse.y +++ b/gcc/c-parse.y @@ -1910,8 +1910,14 @@ label: CASE expr_no_commas ':' if (value != error_mark_node) { tree duplicate; - int success = pushcase (value, convert_and_check, - label, &duplicate); + int success; + + if (pedantic && ! INTEGRAL_TYPE_P (TREE_TYPE (value))) + pedwarn ("label must have integral type in ANSI C"); + + success = pushcase (value, convert_and_check, + label, &duplicate); + if (success == 1) error ("case label not within a switch statement"); else if (success == 2) |