+2005-08-31 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++/23639
bool check_dependency,
bool *ambiguous_p)
{
+ int flags = 0;
tree decl;
tree object_type = parser->context->object_type;
+ if (!cp_parser_uncommitted_to_tentative_parse_p (parser))
+ flags |= LOOKUP_COMPLAIN;
+
/* Assume that the lookup will be unambiguous. */
if (ambiguous_p)
*ambiguous_p = false;
/* Look it up in the enclosing context, too. */
decl = lookup_name_real (name, tag_type != none_type,
/*nonclass=*/0,
- /*block_p=*/true, is_namespace,
- /*flags=*/0);
+ /*block_p=*/true, is_namespace, flags);
parser->object_scope = object_type;
parser->qualifying_scope = NULL_TREE;
if (object_decl)
{
decl = lookup_name_real (name, tag_type != none_type,
/*nonclass=*/0,
- /*block_p=*/true, is_namespace,
- /*flags=*/0);
+ /*block_p=*/true, is_namespace, flags);
parser->qualifying_scope = NULL_TREE;
parser->object_scope = NULL_TREE;
}
+2005-08-31 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ PR c++/13377
+ * g++.dg/lookup/ambig4.C: New test.
+ * g++.dg/lookup/ambig5.C: New test.
+ * g++.dg/tc1/dr101.C: Adjust error markers.
+
2005-08-31 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/23639
--- /dev/null
+// PR c++/13377
+// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+// { dg-do compile }
+
+namespace N
+{
+ int i; // { dg-error "declared" }
+}
+
+int i; // { dg-error "declared" }
+
+using namespace N;
+
+void foo() { i; } // { dg-error "in this scope|ambiguous" }
--- /dev/null
+// PR c++/13377
+// Origin: Boris Kolpackov <boris@kolpackov.net>
+// { dg-do compile }
+
+namespace N
+{
+ namespace M {} // { dg-error "declared" }
+}
+
+namespace M {} // { dg-error "declared" }
+
+using namespace N;
+using namespace M; // { dg-error "namespace-name|ambiguous" }
namespace Test2 {
- typedef unsigned int X;
+ typedef unsigned int X; // { dg-bogus "declared" "" { xfail *-*-* } }
extern "C" int f2();
namespace N {
- typedef unsigned int X;
+ typedef unsigned int X; // { dg-bogus "declared" "" { xfail *-*-* } }
extern "C" int f2();
}
using namespace N;