aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl.cc')
-rw-r--r--gcc/cp/decl.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 70ad681..ff56fdd 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -8253,6 +8253,14 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
&& !TYPE_REF_P (type))
TREE_CONSTANT (decl) = 1;
}
+ /* This is handled mostly by gimplify.cc, but we have to deal with
+ not warning about int x = x; as it is a GCC extension to turn off
+ this warning but only if warn_init_self is zero. */
+ if (!DECL_EXTERNAL (decl)
+ && !TREE_STATIC (decl)
+ && decl == tree_strip_any_location_wrapper (init)
+ && !warn_init_self)
+ suppress_warning (decl, OPT_Winit_self);
}
if (flag_openmp