This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH], c++] Fix PR30566 and PR41825


On 05/12/2010 03:52 AM, Shujing Zhao wrote:
+		   {
+		     tree decl = scope->names;
+		     if ((decl == context)
+		     	 || (decl && scope->kind == sk_function_parms
+			     && DECL_CONTEXT (decl) == context))

Looking at scope->names is the wrong way to handle this; this test won't stop when you get to the context of oldlocal if it happens to be a function with no parameters. Instead, look for


scope->kind == sk_function_parms && scope->this_entity == context

+		      break;
+		     if (decl)
+		       {
+		         tree type = TREE_TYPE (decl);
+		         if (TREE_CODE (type) == RECORD_TYPE
+			     && !LAMBDA_TYPE_P (type))

And this test would trigger on a variable; you want


scope->kind == sk_class && !LAMBDA_TYPE_P (scope->this_entity)

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]