diff options
-rw-r--r-- | gcc/c-family/c-objc.h | 1 | ||||
-rw-r--r-- | gcc/c-family/stub-objc.c | 6 | ||||
-rw-r--r-- | gcc/cp/constexpr.c | 2 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 16 |
4 files changed, 23 insertions, 2 deletions
diff --git a/gcc/c-family/c-objc.h b/gcc/c-family/c-objc.h index 6025283..4577e4f 100644 --- a/gcc/c-family/c-objc.h +++ b/gcc/c-family/c-objc.h @@ -101,6 +101,7 @@ extern void objc_add_synthesize_declaration (location_t, tree); extern void objc_add_dynamic_declaration (location_t, tree); extern const char * objc_maybe_printable_name (tree, int); extern bool objc_is_property_ref (tree); +extern bool objc_non_constant_expr_p (tree); extern bool objc_string_ref_type_p (tree); extern void objc_check_format_arg (tree, tree); extern void objc_finish_function (void); diff --git a/gcc/c-family/stub-objc.c b/gcc/c-family/stub-objc.c index c30f0b3..d017acf 100644 --- a/gcc/c-family/stub-objc.c +++ b/gcc/c-family/stub-objc.c @@ -331,6 +331,12 @@ objc_is_property_ref (tree ARG_UNUSED (node)) return 0; } +bool +objc_non_constant_expr_p (tree) +{ + return 0; +} + tree objc_maybe_build_component_ref (tree ARG_UNUSED (datum), tree ARG_UNUSED (component)) { diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 7033a49..b6f9c43 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -8413,7 +8413,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, return false; default: - if (objc_is_property_ref (t)) + if (objc_non_constant_expr_p (t)) return false; sorry ("unexpected AST of kind %s", get_tree_code_name (TREE_CODE (t))); diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 0393bc4..c0d07ae 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -1720,7 +1720,6 @@ objc_build_class_component_ref (tree class_name, tree property_ident) } - /* This is used because we don't want to expose PROPERTY_REF to the C/C++ frontends. Maybe we should! */ bool @@ -1732,6 +1731,21 @@ objc_is_property_ref (tree node) return false; } +/* We use this to report tree codes that are known to be invalid in const- + expression contexts. */ +bool +objc_non_constant_expr_p (tree node) +{ + switch (TREE_CODE (node)) + { + default: + return false; + case MESSAGE_SEND_EXPR: + case PROPERTY_REF: + return true; + } +} + /* This function builds a setter call for a PROPERTY_REF (real, for a declared property, or artificial, for a dot-syntax accessor which is not corresponding to a property). 'lhs' must be a PROPERTY_REF |