re PR c++/20240 (invalid using-redeclaration accepted)
PR c++/20240 * decl.c (decls_match): Compare context of VAR_DECL. * g++.dg/lookup/using13.C: New test. From-SVN: r96725
This commit is contained in:
parent
26c895e7dc
commit
91a5bc9f9a
|
@ -1,3 +1,8 @@
|
|||
2005-03-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
|
||||
PR c++/20240
|
||||
* decl.c (decls_match): Compare context of VAR_DECL.
|
||||
|
||||
2005-03-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
|
||||
PR c++/20333
|
||||
|
|
|
@ -948,6 +948,12 @@ decls_match (tree newdecl, tree olddecl)
|
|||
}
|
||||
else
|
||||
{
|
||||
/* Need to check scope for variable declaration (VAR_DECL).
|
||||
For typedef (TYPE_DECL), scope is ignored. */
|
||||
if (TREE_CODE (newdecl) == VAR_DECL
|
||||
&& CP_DECL_CONTEXT (newdecl) != CP_DECL_CONTEXT (olddecl))
|
||||
return 0;
|
||||
|
||||
if (TREE_TYPE (newdecl) == error_mark_node)
|
||||
types_match = TREE_TYPE (olddecl) == error_mark_node;
|
||||
else if (TREE_TYPE (olddecl) == NULL_TREE)
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2005-03-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
|
||||
PR c++/20240
|
||||
* g++.dg/lookup/using13.C: New test.
|
||||
|
||||
2005-03-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
|
||||
PR c++/20333
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// { dg-do compile }
|
||||
|
||||
// Origin: Stefan Straßer <sstrasser@systemhaus-gruppe.de>
|
||||
|
||||
// PR c++/20240:
|
||||
|
||||
namespace A { int a; }
|
||||
|
||||
namespace C{
|
||||
int a;
|
||||
using A::a; // { dg-error "already declared" }
|
||||
}
|
Loading…
Reference in New Issue