diff options
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 21920b4..c1c16f4 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1130,6 +1130,11 @@ finish_switch_cond (tree cond, tree switch_stmt) orig_type = TREE_TYPE (cond); if (cond != error_mark_node) { + /* Warn if the condition has boolean value. */ + if (TREE_CODE (orig_type) == BOOLEAN_TYPE) + warning_at (input_location, OPT_Wswitch_bool, + "switch condition has type bool"); + /* [stmt.switch] Integral promotions are performed. */ |