diff options
author | Jason Merrill <jason@redhat.com> | 2012-07-02 15:14:23 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2012-07-02 15:14:23 -0400 |
commit | 8d0d1915d9f96a4c9d9418b21b38cfa9c386d7a3 (patch) | |
tree | 8becd43c0137d4c13ec1df45fe08c64cceb0a023 /gcc/cp/search.c | |
parent | 531b10fcb0fe5c86576bda5fd201d8acc7db4525 (diff) | |
download | gcc-8d0d1915d9f96a4c9d9418b21b38cfa9c386d7a3.tar.gz |
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/search.c')
-rw-r--r-- | gcc/cp/search.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/cp/search.c b/gcc/cp/search.c index e6d6be814c6..d112c05713c 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -579,7 +579,8 @@ context_for_name_lookup (tree decl) declared. */ tree context = DECL_CONTEXT (decl); - while (context && TYPE_P (context) && ANON_AGGR_TYPE_P (context)) + while (context && TYPE_P (context) + && (ANON_AGGR_TYPE_P (context) || UNSCOPED_ENUM_P (context))) context = TYPE_CONTEXT (context); if (!context) context = global_namespace; @@ -623,9 +624,7 @@ dfs_access_in_type (tree binfo, void *data) else { /* First, check for an access-declaration that gives us more - access to the DECL. The CONST_DECL for an enumeration - constant will not have DECL_LANG_SPECIFIC, and thus no - DECL_ACCESS. */ + access to the DECL. */ if (DECL_LANG_SPECIFIC (decl) && !DECL_DISCRIMINATOR_P (decl)) { tree decl_access = purpose_member (type, DECL_ACCESS (decl)); |