Commit 0e607f34 by Jason Merrill Committed by Jason Merrill

method.c (hack_identifier): Complain about getting a namespace or class template.

	* method.c (hack_identifier): Complain about getting a namespace
	or class template.
	* typeck.c (decay_conversion): Remove check for namespaces.
	* typeck2.c (incomplete_type_error): Likewise.
	* parse.y (template_arg): Add PTYPENAME expansion.

From-SVN: r20532
parent e4d4bdf2
1998-06-17 Jason Merrill <jason@yorick.cygnus.com>
* method.c (hack_identifier): Complain about getting a namespace
or class template.
* typeck.c (decay_conversion): Remove check for namespaces.
* typeck2.c (incomplete_type_error): Likewise.
* parse.y (template_arg): Add PTYPENAME expansion.
1998-06-16 Andrew MacLeod <amacleod@cygnus.com>
* decl.c (grokvardecl): Don't build external assembler names for
......
......@@ -1845,8 +1845,15 @@ hack_identifier (value, name)
}
}
else if (TREE_CODE (value) == NAMESPACE_DECL)
/* A namespace is not really expected here; this is likely illegal code. */
return value;
{
cp_error ("use of namespace `%D' as expression", value);
return error_mark_node;
}
else if (DECL_CLASS_TEMPLATE_P (value))
{
cp_error ("use of class template `%T' as expression", value);
return error_mark_node;
}
else
mark_used (value);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -885,6 +885,8 @@ template_arg_list:
template_arg:
type_id
{ $$ = groktypename ($1.t); }
| PTYPENAME
{ $$ = lastiddecl; }
| expr_no_commas %prec ARITHCOMPARE
;
......
......@@ -1620,12 +1620,6 @@ decay_conversion (exp)
type = TREE_TYPE (exp);
}
if (TREE_CODE (exp) == NAMESPACE_DECL)
{
cp_error ("namespace `%D' used as expression", exp);
return error_mark_node;
}
/* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
Leave such NOP_EXPRs, since RHS is being used in non-lvalue context. */
......
......@@ -274,8 +274,6 @@ incomplete_type_error (value, type)
if (value != 0 && (TREE_CODE (value) == VAR_DECL
|| TREE_CODE (value) == PARM_DECL))
cp_error ("`%D' has incomplete type", value);
else if (value && TREE_CODE (value) == NAMESPACE_DECL)
cp_error ("namespace `%D' used as expression", value);
else
{
retry:
......
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