Commit 07681121 by Mark Mitchell Committed by Mark Mitchell

re PR c++/9400 (Warning -Wshadow warns of shadowed declaration of THIS in local classes.)

	PR c++/9400
	* decl.c (pushdecl): Don't check for shadowing of DECL_ARTIFICIAL
	PARM_DECLs.

	PR c++/9400
	* g++.dg/warn/Wshadow-2.C: New test.

From-SVN: r63904
parent 3d1df1fa
2003-03-06 Mark Mitchell <mark@codesourcery.com> 2003-03-06 Mark Mitchell <mark@codesourcery.com>
PR c++/9400
* decl.c (pushdecl): Don't check for shadowing of DECL_ARTIFICIAL
PARM_DECLs.
PR c++/9791 PR c++/9791
* class.c (get_basefndecls): Use lookup_fnfields_1. * class.c (get_basefndecls): Use lookup_fnfields_1.
......
...@@ -4101,7 +4101,9 @@ pushdecl (tree x) ...@@ -4101,7 +4101,9 @@ pushdecl (tree x)
if (oldlocal != NULL_TREE && !DECL_EXTERNAL (x) if (oldlocal != NULL_TREE && !DECL_EXTERNAL (x)
/* Inline decls shadow nothing. */ /* Inline decls shadow nothing. */
&& !DECL_FROM_INLINE (x) && !DECL_FROM_INLINE (x)
&& TREE_CODE (oldlocal) == PARM_DECL) && TREE_CODE (oldlocal) == PARM_DECL
/* Don't check the `this' parameter. */
&& !DECL_ARTIFICIAL (oldlocal))
{ {
bool err = false; bool err = false;
......
2003-03-06 Mark Mitchell <mark@codesourcery.com> 2003-03-06 Mark Mitchell <mark@codesourcery.com>
PR c++/9400
* g++.dg/warn/Wshadow-2.C: New test.
PR c++/9791 PR c++/9791
* g++.dg/warn/Woverloaded-1.C: New test. * g++.dg/warn/Woverloaded-1.C: New test.
......
/* { dg-options "-Wshadow" } */
struct A {
void a1 () {
struct B { B() {} }; // There should be no warning here.
}
void a2 () {
struct B { };
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment