]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/43069 (ICE: tree check: expected tree that contains 'decl minimal' structur...
authorJason Merrill <jason@redhat.com>
Wed, 17 Feb 2010 22:51:43 +0000 (17:51 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 17 Feb 2010 22:51:43 +0000 (17:51 -0500)
PR c++/43069
* name-lookup.c (set_decl_namespace): Don't copy DECL_CONTEXT if the
decl we looked up doesn't match.

From-SVN: r156841

gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/namespace11.C [new file with mode: 0644]

index ab5fbe5c196e07dd8abbeacb5390e2e41cc11436..ef12985789a93ed1002a9c3d755a945dfde0f0fa 100644 (file)
@@ -1,5 +1,9 @@
 2010-02-17  Jason Merrill  <jason@redhat.com>
 
+       PR c++/43069
+       * name-lookup.c (set_decl_namespace): Don't copy DECL_CONTEXT if the
+       decl we looked up doesn't match.
+
        PR c++/43093
        * cp-gimplify.c (cp_gimplify_expr) [INIT_EXPR]: Return if we don't
        have an INIT_EXPR anymore.
index 1f595c0eb92b31101166ea08dfdb09a9874532e2..7b43d30f47e8f58029bf6897b2dfff4a0029cc93 100644 (file)
@@ -3102,7 +3102,8 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
   if (!is_overloaded_fn (decl))
     {
       /* We might have found OLD in an inline namespace inside SCOPE.  */
-      DECL_CONTEXT (decl) = DECL_CONTEXT (old);
+      if (TREE_CODE (decl) == TREE_CODE (old))
+       DECL_CONTEXT (decl) = DECL_CONTEXT (old);
       /* Don't compare non-function decls with decls_match here, since
         it can't check for the correct constness at this
         point. pushdecl will find those errors later.  */
index 34729bce210be2db0afee88e77a8947fdb7d18a9..d2b7655951d1d2cbb2d3528b8322d90038fc24bf 100644 (file)
@@ -1,5 +1,8 @@
 2010-02-17  Jason Merrill  <jason@redhat.com>
 
+       PR c++/43069
+       * g++.dg/parse/namespace11.C: New.
+
        PR c++/43093
        * g++.dg/ext/attrib37.C: New.
 
diff --git a/gcc/testsuite/g++.dg/parse/namespace11.C b/gcc/testsuite/g++.dg/parse/namespace11.C
new file mode 100644 (file)
index 0000000..7fa73b6
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/43069
+
+namespace std {
+  template < typename >
+  void swap ();
+}
+template std::swap             // { dg-error "" }