Commit 91a5bc9f by Kriang Lerdsuwanakij Committed by Kriang Lerdsuwanakij

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
parent 26c895e7
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
* parser.c (cp_parser_postfix_expression) <case RID_TYPENAME>:
Check the return value of cp_parser_nested_name_specifier.
......
......@@ -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)
......
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
* g++.dg/template/crash36.C: New test.
......
// { dg-do compile }
// Origin: Stefan Straer <sstrasser@systemhaus-gruppe.de>
// PR c++/20240:
namespace A { int a; }
namespace C{
int a;
using A::a; // { dg-error "already declared" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment