Commit 7756db03 by Mark Mitchell Committed by Mark Mitchell

re PR c++/16707 (ICE with using)

	PR c++/16707
	* name-lookup.c (validate_nonmember_using_decl): Robustify.

	PR c++/16707
	* g++.dg/lookup/using12.C: New test.

From-SVN: r85446
parent 6ed7c4d8
2004-08-02 Mark Mitchell <mark@codesourcery.com>
PR c++/16707
* name-lookup.c (validate_nonmember_using_decl): Robustify.
2004-08-01 Mark Mitchell <mark@codesourcery.com>
PR c++/16224
......
......@@ -2115,6 +2115,17 @@ push_overloaded_decl (tree decl, int flags)
static tree
validate_nonmember_using_decl (tree decl, tree scope, tree name)
{
/* [namespace.udecl]
A using-declaration for a class member shall be a
member-declaration. */
if (TYPE_P (scope))
{
error ("`%T' is not a namespace", scope);
return NULL_TREE;
}
else if (scope == error_mark_node)
return NULL_TREE;
if (TREE_CODE (decl) == TEMPLATE_ID_EXPR)
{
/* 7.3.3/5
......@@ -2142,15 +2153,6 @@ validate_nonmember_using_decl (tree decl, tree scope, tree name)
my_friendly_assert (DECL_P (decl), 20020908);
/* [namespace.udecl]
A using-declaration for a class member shall be a
member-declaration. */
if (TYPE_P (scope))
{
error ("`%T' is not a namespace", scope);
return NULL_TREE;
}
/* Make a USING_DECL. */
return push_using_decl (scope, name);
}
......
2004-08-02 Mark Mitchell <mark@codesourcery.com>
PR c++/16707
* g++.dg/lookup/using12.C: New test.
* g++.dg/init/null1.C: Fix PR number.
* g++.dg/parse/namespace10.C: Likewise.
......
// PR c++/16707
int i;
using N::i; // { dg-error "declared|expected" }
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