PR c++/72707
* name-lookup.c (pushdecl_maybe_friend_1): Do check shadowing of
artificial x if it is an anonymous union variable.
* g++.dg/warn/Wshadow-12.C: New test.
From-SVN: r243877
2016-12-21 Jakub Jelinek <jakub@redhat.com>
+ PR c++/72707
+ * name-lookup.c (pushdecl_maybe_friend_1): Do check shadowing of
+ artificial x if it is an anonymous union variable.
+
PR bootstrap/78817
* typeck.c (cp_build_function_call_vec): If check_function_arguments
returns true, set TREE_NO_WARNING on CALL_EXPR.
|| TREE_CODE (x) == TYPE_DECL)))
/* Don't check for internally generated vars unless
it's an implicit typedef (see create_implicit_typedef
- in decl.c). */
- && (!DECL_ARTIFICIAL (x) || DECL_IMPLICIT_TYPEDEF_P (x)))
+ in decl.c) or anonymous union variable. */
+ && (!DECL_ARTIFICIAL (x)
+ || DECL_IMPLICIT_TYPEDEF_P (x)
+ || (VAR_P (x) && DECL_ANON_UNION_VAR_P (x))))
{
bool nowarn = false;
+2016-12-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/72707
+ * g++.dg/warn/Wshadow-12.C: New test.
+
2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/78580
--- /dev/null
+// PR c++/72707
+// { dg-do compile }
+
+void
+foo (double x)
+{
+ union { int x; }; // { dg-error "shadows a parameter" }
+ x = 0;
+}