* decl.c (push_namespace): Namespaces have type void.
* typeck2.c (incomplete_type_error): Complain about namespace
used as expression.
* typeck.c (decay_conversion): Likewise.
* error.c (dump_expr): Support namespaces.
From-SVN: r20035
+1998-05-24 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (push_namespace): Namespaces have type void.
+ * typeck2.c (incomplete_type_error): Complain about namespace
+ used as expression.
+ * typeck.c (decay_conversion): Likewise.
+
+1998-05-24 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * error.c (dump_expr): Support namespaces.
+
1998-05-23 Jason Merrill <jason@yorick.cygnus.com>
* cp-tree.def: Add SRCLOC.
if (need_new)
{
/* Make a new namespace, binding the name to it. */
- d = build_lang_decl (NAMESPACE_DECL, name, NULL_TREE);
+ d = build_lang_decl (NAMESPACE_DECL, name, void_type_node);
/* The global namespace is not pushed, and the global binding
level is set elsewhere. */
if (!global)
case CONST_DECL:
case FUNCTION_DECL:
case TEMPLATE_DECL:
+ case NAMESPACE_DECL:
dump_decl (t, -1);
break;
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. */
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: