decl.c (start_decl): Don't just complain about a mismatched scope, fix it.
authorJason Merrill <jason@yorick.cygnus.com>
Thu, 20 Nov 1997 04:43:53 +0000 (04:43 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 20 Nov 1997 04:43:53 +0000 (23:43 -0500)
* decl.c (start_decl): Don't just complain about a mismatched
scope, fix it.

From-SVN: r16591

gcc/cp/ChangeLog
gcc/cp/decl.c

index f10aea4a7b487ed61493703b416d2b3591e81af3..b123b92966ed82a4a32f447f59ff1e927530f73f 100644 (file)
@@ -1,5 +1,8 @@
 Wed Nov 19 18:24:14 1997  Jason Merrill  <jason@yorick.cygnus.com>
 
+       * decl.c (start_decl): Don't just complain about a mismatched 
+       scope, fix it.
+
        * decl.c (make_implicit_typename): Handle case where t is not
        actually from context.
        * tree.c (get_type_decl): Lose identifier case.
index 3aa8201200afaaa5a26a2a55a38db90a3f5113ac..5cda56a1f763246426f5b274c51f60c582df1782 100644 (file)
@@ -6009,7 +6009,12 @@ start_decl (declarator, declspecs, initialized)
          else
            {
              if (DECL_CONTEXT (field) != context)
-               cp_pedwarn ("ANSI C++ does not permit `%T::%D' to be defined as `%T::%D'", DECL_CONTEXT (field), DECL_NAME (decl), context, DECL_NAME (decl));
+               {
+                 cp_pedwarn ("ANSI C++ does not permit `%T::%D' to be defined as `%T::%D'",
+                             DECL_CONTEXT (field), DECL_NAME (decl),
+                             context, DECL_NAME (decl));
+                 DECL_CONTEXT (decl) = DECL_CONTEXT (field);
+               }
              if (duplicate_decls (decl, field))
                decl = field;
            }