]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/32898 (Definition of variable N::i outside namespace N not rejected)
authorJakub Jelinek <jakub@redhat.com>
Fri, 24 Aug 2007 17:09:50 +0000 (19:09 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 24 Aug 2007 17:09:50 +0000 (19:09 +0200)
PR c++/32898
* name-lookup.c (set_decl_namespace): lookup_qualified_name failure
is error_mark_node rather than NULL_TREE.
* pt.c (check_explicit_specialization): Likewise.

* g++.dg/lookup/ns3.C: New test.

From-SVN: r127777

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

index 51894de0715fd91157cc9c345532a9ad5043f207..db4c828b133e81428c30305f4ee80cf75ef07204 100644 (file)
@@ -1,3 +1,10 @@
+2007-08-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/32898
+       * name-lookup.c (set_decl_namespace): lookup_qualified_name failure
+       is error_mark_node rather than NULL_TREE.
+       * pt.c (check_explicit_specialization): Likewise.
+
 2007-08-22  Jason Merrill  <jason@redhat.com>
 
        PR c++/29365
index b0358479b56edbd01c64aadddd4736a90d1e357d..744dd5c489ecc3568967a992eba2413b15693b1e 100644 (file)
@@ -2924,7 +2924,7 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
 
   /* See whether this has been declared in the namespace.  */
   old = lookup_qualified_name (scope, DECL_NAME (decl), false, true);
-  if (!old)
+  if (old == error_mark_node)
     /* No old declaration at all.  */
     goto complain;
   if (!is_overloaded_fn (decl))
index d6749ebb959b6dcad1fe92b891e5abd3d1e35e80..ac28afa4136fffd7394e42ee0fd1f20dec2aff1a 100644 (file)
@@ -1971,7 +1971,7 @@ check_explicit_specialization (tree declarator,
                 context.  */
              fns = lookup_qualified_name (CP_DECL_CONTEXT (decl), dname,
                                           false, true);
-             if (!fns || !is_overloaded_fn (fns))
+             if (fns == error_mark_node || !is_overloaded_fn (fns))
                {
                  error ("%qD is not a template function", dname);
                  fns = error_mark_node;
index f4ffedc4e4230855df8c5da09f8f015bf223e34d..7e1bc9295060b2e64074ca4932ec728d669c3779 100644 (file)
@@ -1,5 +1,8 @@
 2007-08-24  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/32898
+       * g++.dg/lookup/ns3.C: New test.
+
        PR debug/32610
        * gcc.dg/debug/pr32610.c: New test.
 
diff --git a/gcc/testsuite/g++.dg/lookup/ns3.C b/gcc/testsuite/g++.dg/lookup/ns3.C
new file mode 100644 (file)
index 0000000..144cba7
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/32898
+
+namespace N { }
+
+int N::i;      // { dg-error "should have been declared inside" }