re PR c++/9384 (ICE in validate_nonmember_using_decl, at cp/decl2.c:4152)
authorMark Mitchell <mark@codesourcery.com>
Wed, 22 Jan 2003 19:28:23 +0000 (19:28 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 22 Jan 2003 19:28:23 +0000 (19:28 +0000)
PR c++/9384
* parser.c (cp_parser_using_declaration): Issue error messages
about name resolution failures here.

PR c++/9384
* g++.dg/parse/using1.C: New test.

From-SVN: r61611

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/using1.C [new file with mode: 0644]

index 3bc0455..02262fd 100644 (file)
@@ -1,5 +1,9 @@
 2003-01-22  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/9384
+       * parser.c (cp_parser_using_declaration): Issue error messages
+       about name resolution failures here.
+
        PR c++/9388
        * class.c (currently_open_derived_class): Use dependent_type_p.
        * cp-tree.h (dependent_type_p): New function.
index df9284c..7f4eeaf 100644 (file)
@@ -9219,7 +9219,15 @@ cp_parser_using_declaration (parser)
   else
     {
       decl = cp_parser_lookup_name_simple (parser, identifier);
-      if (scope)
+      if (decl == error_mark_node)
+       {
+         if (parser->scope && parser->scope != global_namespace)
+           error ("`%D::%D' has not been declared", 
+                  parser->scope, identifier);
+         else
+           error ("`::%D' has not been declared", identifier);
+       }
+      else if (scope)
        do_local_using_decl (decl);
       else
        do_toplevel_using_decl (decl);
index cbf0ad9..1bc7453 100644 (file)
@@ -1,5 +1,8 @@
 2003-01-22  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/9384
+       * g++.dg/parse/using1.C: New test.
+
        PR c++/9285
        PR c++/9294
        * g++.dg/parse/expr2.C: New test.
diff --git a/gcc/testsuite/g++.dg/parse/using1.C b/gcc/testsuite/g++.dg/parse/using1.C
new file mode 100644 (file)
index 0000000..efe7a0e
--- /dev/null
@@ -0,0 +1 @@
+namespace A { using ::B; } // { dg-error "" }