* decl.c (decls_match): Compare context of VAR_DECL.
* g++.dg/lookup/using13.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96725
138bc75d-0d04-0410-961f-
82ee72b054a4
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.
}
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.
--- /dev/null
+// { 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" }
+}