]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/13377 (unexpected behavior of namespace usage directive)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Thu, 1 Sep 2005 11:32:20 +0000 (11:32 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Thu, 1 Sep 2005 11:32:20 +0000 (11:32 +0000)
PR c++/13377
* parser.c (cp_parser_lookup_name): Pass LOOKUP_COMPLAIN to
lookup_name_real on final parse.

* g++.dg/lookup/ambig4.C: New test.
* g++.dg/lookup/ambig5.C: New test.

From-SVN: r103724

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/ambig4.C

index 837e088493948fb50451e4203f5311fb02462544..b054e31a7e6ccc5f4f97072d113c71f9e5ca8b1e 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-01  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/13377
+       * parser.c (cp_parser_lookup_name): Pass LOOKUP_COMPLAIN to
+       lookup_name_real on final parse.
+
 2005-08-31  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/23586
index 332cc9b0d099a7f6f865c6d60d9390949438c26d..1edbafca7ccdf3b5dd7d9432841dd64bac2574fb 100644 (file)
@@ -13713,6 +13713,7 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
                       bool is_type, bool is_template, bool is_namespace,
                       bool check_dependency)
 {
+  int flags = 0;
   tree decl;
   tree object_type = parser->context->object_type;
 
@@ -13724,6 +13725,10 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
   if (name == error_mark_node)
     return error_mark_node;
 
+  if (!cp_parser_parsing_tentatively (parser)
+      || cp_parser_committed_to_tentative_parse (parser))
+    flags |= LOOKUP_COMPLAIN;
+
   /* A template-id has already been resolved; there is no lookup to
      do.  */
   if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
@@ -13837,8 +13842,7 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
                                     /*protect=*/0, is_type);
       /* Look it up in the enclosing context, too.  */
       decl = lookup_name_real (name, is_type, /*nonclass=*/0, 
-                              is_namespace,
-                              /*flags=*/0);
+                              is_namespace, flags);
       parser->object_scope = object_type;
       parser->qualifying_scope = NULL_TREE;
       if (object_decl)
@@ -13847,8 +13851,7 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
   else
     {
       decl = lookup_name_real (name, is_type, /*nonclass=*/0, 
-                              is_namespace,
-                              /*flags=*/0);
+                              is_namespace, flags);
       parser->qualifying_scope = NULL_TREE;
       parser->object_scope = NULL_TREE;
     }
index 4f18fa1ad3a2128b03ded424d1033ce50e3f31c1..81e6c9a0c4399b3306d9e322877287d3d71d0b05 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-01  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/13377
+       * g++.dg/lookup/ambig4.C: New test.
+       * g++.dg/lookup/ambig5.C: New test.
+
 2005-08-31  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/23639
index ab1a14518d59c79ab5b42173750490f8e2dd7e36..dbe53db02c9d561152dd5a03d44daa56a86031ba 100644 (file)
@@ -11,4 +11,4 @@ int i;              // { dg-error "declared" }
 
 using namespace N;
 
-void foo() { i; }   // { dg-error "in this scope|ambiguous" }
+void foo() { i; }   // { dg-error "undeclared|ambiguous" }