mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-10 05:50:28 +08:00
re PR c++/13377 (unexpected behavior of namespace usage directive)
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. * g++.dg/tc1/dr101.C: Adjust error markers. From-SVN: r103667
This commit is contained in:
parent
1e1b4b377c
commit
ef07d61bcb
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
@ -14464,9 +14464,13 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
|
||||
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;
|
||||
@ -14599,8 +14603,7 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
|
||||
/* 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)
|
||||
@ -14610,8 +14613,7 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -1,3 +1,10 @@
|
||||
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
|
||||
|
14
gcc/testsuite/g++.dg/lookup/ambig4.C
Normal file
14
gcc/testsuite/g++.dg/lookup/ambig4.C
Normal file
@ -0,0 +1,14 @@
|
||||
// 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" }
|
13
gcc/testsuite/g++.dg/lookup/ambig5.C
Normal file
13
gcc/testsuite/g++.dg/lookup/ambig5.C
Normal file
@ -0,0 +1,13 @@
|
||||
// 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" }
|
@ -17,10 +17,10 @@ namespace Test1 {
|
||||
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user