mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/72707 (local anonymous union member hides names in the same scope)
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
This commit is contained in:
parent
d8ee9c7e54
commit
b5f8e89ed7
|
|
@ -1,5 +1,9 @@
|
||||||
2016-12-21 Jakub Jelinek <jakub@redhat.com>
|
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
|
PR bootstrap/78817
|
||||||
* typeck.c (cp_build_function_call_vec): If check_function_arguments
|
* typeck.c (cp_build_function_call_vec): If check_function_arguments
|
||||||
returns true, set TREE_NO_WARNING on CALL_EXPR.
|
returns true, set TREE_NO_WARNING on CALL_EXPR.
|
||||||
|
|
|
||||||
|
|
@ -1111,8 +1111,10 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend)
|
||||||
|| TREE_CODE (x) == TYPE_DECL)))
|
|| TREE_CODE (x) == TYPE_DECL)))
|
||||||
/* Don't check for internally generated vars unless
|
/* Don't check for internally generated vars unless
|
||||||
it's an implicit typedef (see create_implicit_typedef
|
it's an implicit typedef (see create_implicit_typedef
|
||||||
in decl.c). */
|
in decl.c) or anonymous union variable. */
|
||||||
&& (!DECL_ARTIFICIAL (x) || DECL_IMPLICIT_TYPEDEF_P (x)))
|
&& (!DECL_ARTIFICIAL (x)
|
||||||
|
|| DECL_IMPLICIT_TYPEDEF_P (x)
|
||||||
|
|| (VAR_P (x) && DECL_ANON_UNION_VAR_P (x))))
|
||||||
{
|
{
|
||||||
bool nowarn = false;
|
bool nowarn = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
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>
|
2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
|
||||||
|
|
||||||
PR rtl-optimization/78580
|
PR rtl-optimization/78580
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
// PR c++/72707
|
||||||
|
// { dg-do compile }
|
||||||
|
|
||||||
|
void
|
||||||
|
foo (double x)
|
||||||
|
{
|
||||||
|
union { int x; }; // { dg-error "shadows a parameter" }
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue