]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/27933 (ICE with invalid "using")
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Mon, 12 Jun 2006 21:23:30 +0000 (21:23 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Mon, 12 Jun 2006 21:23:30 +0000 (21:23 +0000)
PR c++/27933
* name-lookup.c (lookup_qualified_name): Always return error_mark_node
if lookup fails.

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

From-SVN: r114582

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

index 7016c34afee952b4bd04ffbc22c067b1fa797b0b..9ad78f4e6c87623590fad32856c76e979a457e4a 100644 (file)
@@ -1,5 +1,9 @@
 2006-06-12  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/27933
+       * name-lookup.c (lookup_qualified_name): Always return error_mark_node
+       if lookup fails.
+
        PR c++/27951
        * decl2.c (finish_anon_union): Return early if build_anon_union_vars
        fails.
index 6eab5fe335a060ad42b4ed4b69fe8020506fe87d..2d71f3bfa11cd689ebb800590839d5aa6ebd1be3 100644 (file)
@@ -3590,6 +3590,7 @@ tree
 lookup_qualified_name (tree scope, tree name, bool is_type_p, bool complain)
 {
   int flags = 0;
+  tree t = NULL_TREE;
 
   if (TREE_CODE (scope) == NAMESPACE_DECL)
     {
@@ -3599,17 +3600,14 @@ lookup_qualified_name (tree scope, tree name, bool is_type_p, bool complain)
       if (is_type_p)
        flags |= LOOKUP_PREFER_TYPES;
       if (qualified_lookup_using_namespace (name, scope, &binding, flags))
-       return select_decl (&binding, flags);
+       t = select_decl (&binding, flags);
     }
   else if (is_aggr_type (scope, complain))
-    {
-      tree t;
-      t = lookup_member (scope, name, 2, is_type_p);
-      if (t)
-       return t;
-    }
+    t = lookup_member (scope, name, 2, is_type_p);
 
-  return error_mark_node;
+  if (!t)
+    return error_mark_node;
+  return t;
 }
 
 /* Subroutine of unqualified_namespace_lookup:
index 01844c771ec5ee3fefbadf9f9dadad803b6d98bb..6ae8ee10960bf759d38ec01916c37ac001ab5842 100644 (file)
@@ -1,5 +1,8 @@
 2006-06-12  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/27933
+       * g++.dg/lookup/using15.C: New test.
+
        PR c++/27951
        * g++.dg/other/anon4.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/lookup/using15.C b/gcc/testsuite/g++.dg/lookup/using15.C
new file mode 100644 (file)
index 0000000..b5ca3a8
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/27933
+// { dg-do compile }
+
+template<int> struct A
+{
+  int i;
+  A() { using i; }  // { dg-error "nested-name-specifier|declared" }
+};
+
+A<0> a;