aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-07-02 15:14:23 -0400
committerJason Merrill <jason@gcc.gnu.org>2012-07-02 15:14:23 -0400
commit8d0d1915d9f96a4c9d9418b21b38cfa9c386d7a3 (patch)
tree8becd43c0137d4c13ec1df45fe08c64cceb0a023 /gcc/cp/decl2.c
parent531b10fcb0fe5c86576bda5fd201d8acc7db4525 (diff)
downloadgcc-8d0d1915d9f96a4c9d9418b21b38cfa9c386d7a3.zip
gcc-8d0d1915d9f96a4c9d9418b21b38cfa9c386d7a3.tar.gz
gcc-8d0d1915d9f96a4c9d9418b21b38cfa9c386d7a3.tar.bz2
re PR c++/53524 (Bogus enum comparison warning)
PR c++/53524 gcc/cp/ * call.c (build_conditional_expr_1): Don't warn about comparison of two enumerators before their enumeration is complete. (build_new_op_1): Call decay_conversion before warn_logical_operator. * decl.c (build_enumerator): Set DECL_CONTEXT of an enumerator to its enumeration. * decl2.c (mark_used): Call used_types_insert for enums. * semantics.c (finish_id_expression): Don't decay CONST_DECL. (finish_member_declaration): Don't change DECL_CONTEXT of enumerators. * class.c (check_field_decls): Don't change DECL_CONTEXT of enums. * typeck.c (convert_for_assignment): Don't decay CONST_DECL. (build_class_member_access_expr): Look through unscoped enums. * search.c (context_for_name_lookup): Look through unscoped enums. * pt.c (tsubst_copy_and_build): Don't decay CONST_DECL. (tsubst_copy): Use DECL_CONTEXT to find the enumeration. * tree.c (decl_linkage): Likewise. * cvt.c (ocp_convert): Check decayed expr for enum range warning. gcc/c-family/ * c-common.c (get_priority): Call default_conversion. From-SVN: r189174
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index d8c7260..cbb1053 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4205,6 +4205,10 @@ mark_used (tree decl)
if (DECL_CLONED_FUNCTION_P (decl))
TREE_USED (DECL_CLONED_FUNCTION (decl)) = 1;
+ /* Mark enumeration types as used. */
+ if (TREE_CODE (decl) == CONST_DECL)
+ used_types_insert (DECL_CONTEXT (decl));
+
if (TREE_CODE (decl) == FUNCTION_DECL
&& DECL_DELETED_FN (decl))
{