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
This commit is contained in:
Jason Merrill 1998-06-17 02:07:29 +00:00 committed by Jason Merrill
parent e4d4bdf2a9
commit 0e607f3473
6 changed files with 3689 additions and 3670 deletions

View File

@ -1,3 +1,11 @@
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

View File

@ -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);

File diff suppressed because it is too large Load Diff

View File

@ -885,6 +885,8 @@ template_arg_list:
template_arg:
type_id
{ $$ = groktypename ($1.t); }
| PTYPENAME
{ $$ = lastiddecl; }
| expr_no_commas %prec ARITHCOMPARE
;

View File

@ -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. */

View File

@ -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: