diff options
Diffstat (limited to 'gcc/c-objc-common.c')
-rw-r--r-- | gcc/c-objc-common.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c index 5a57aa4..73a3241 100644 --- a/gcc/c-objc-common.c +++ b/gcc/c-objc-common.c @@ -332,3 +332,32 @@ c_tree_printer (pretty_printer *pp, text_info *text) pp_string (pp, n); return true; } + +tree +c_objc_common_truthvalue_conversion (tree expr) +{ + retry: + switch (TREE_CODE (TREE_TYPE (expr))) + { + case ARRAY_TYPE: + expr = default_conversion (expr); + if (TREE_CODE (TREE_TYPE (expr)) != ARRAY_TYPE) + goto retry; + + error ("used array that cannot be converted to pointer where scalar is required"); + return error_mark_node; + + case RECORD_TYPE: + error ("used struct type value where scalar is required"); + return error_mark_node; + + case UNION_TYPE: + error ("used union type value where scalar is required"); + return error_mark_node; + default: + break; + } + + return c_common_truthvalue_conversion (expr); +} + |