Commit 44689c12 by Martin v. Löwis Committed by Martin v. Löwis

parse.y (named_complex_class_head_sans_basetype): Do nothing for error_mark_node.

	* parse.y (named_complex_class_head_sans_basetype):
	Do nothing for error_mark_node.
	(maybe_base_class_list): Likewise.
	* decl.c (start_decl): Check for error_mark_node as a type.
	Detected by g++.brendan/array-refs.C.
	(start_decl_1): Likewise. Detected by g++.bugs/900322_01.C.
	(maybe_build_cleanup_1): Likewise. Detected by
	g++.jason/incomplete1.C.
	* tree.c (build_dummy_object): Use void_zero_node instead of the
	error_mark_node
	(is_dummy_object): Check for such a node.  Detected by
	g++.bob/inherit1.C

From-SVN: r25812
parent a4fe0b09
1999-03-17 Martin von Lwis <loewis@informatik.hu-berlin.de>
* parse.y (named_complex_class_head_sans_basetype):
Do not push a scope for error_mark_node.
(maybe_base_class_list): Likewise.
* decl.c (start_decl): Check for error_mark_node as a type.
Detected by g++.brendan/array-refs.C.
(start_decl_1): Likewise. Detected by g++.bugs/900322_01.C.
(maybe_build_cleanup_1): Likewise. Detected by
g++.jason/incomplete1.C.
* tree.c (build_dummy_object): Use void_zero_node instead of the
error_mark_node
(is_dummy_object): Check for such a node.
Detected by g++.bob/inherit1.C
1999-03-16 Jason Merrill <jason@yorick.cygnus.com>
* method.c (old_backref_index): Split out...
......
......@@ -6873,6 +6873,9 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
type = TREE_TYPE (decl);
if (type == error_mark_node)
return NULL_TREE;
/* Don't lose if destructors must be executed at file-level. */
if (! processing_template_decl && TREE_STATIC (decl)
&& TYPE_NEEDS_DESTRUCTOR (complete_type (type))
......@@ -7119,6 +7122,9 @@ start_decl_1 (decl)
tree type = TREE_TYPE (decl);
int initialized = (DECL_INITIAL (decl) != NULL_TREE);
if (type == error_mark_node)
return;
/* If this type of object needs a cleanup, and control may
jump past it, make a new binding level so that it is cleaned
up only when it is initialized first. */
......@@ -7133,9 +7139,7 @@ start_decl_1 (decl)
{
/* Don't allow initializations for incomplete types except for
arrays which might be completed by the initialization. */
if (type == error_mark_node)
; /* Don't complain again. */
else if (TYPE_SIZE (complete_type (type)) != NULL_TREE)
if (TYPE_SIZE (complete_type (type)) != NULL_TREE)
; /* A complete type is ok. */
else if (TREE_CODE (type) != ARRAY_TYPE)
{
......@@ -14321,7 +14325,7 @@ maybe_build_cleanup_1 (decl, auto_delete)
tree decl, auto_delete;
{
tree type = TREE_TYPE (decl);
if (TYPE_NEEDS_DESTRUCTOR (type))
if (type != error_mark_node && TYPE_NEEDS_DESTRUCTOR (type))
{
int temp = 0, flags = LOOKUP_NORMAL|LOOKUP_DESTRUCTOR;
tree rval;
......
......@@ -87,4 +87,3 @@ typedef union {long itype; tree ttype; char *strtype; enum tree_code code; flagg
extern YYSTYPE yylval;
#define YYEMPTY -2
/* YACC parser for C++ syntax.
Copyright (C) 1988, 89, 93-97, 1998 Free Software Foundation, Inc.
Copyright (C) 1988, 89, 93-98, 1999 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
......@@ -2243,26 +2243,32 @@ named_class_head:
xref_basetypes (current_aggr, $1, $<ttype>2, $3);
}
| named_complex_class_head_sans_basetype
{ push_scope (CP_DECL_CONTEXT ($1)); }
{
if ($1 != error_mark_node)
push_scope (CP_DECL_CONTEXT ($1));
}
maybe_base_class_list
{
pop_scope (CP_DECL_CONTEXT ($1));
$$ = TREE_TYPE ($1);
if (current_aggr == union_type_node
&& TREE_CODE ($$) != UNION_TYPE)
cp_pedwarn ("`union' tag used in declaring `%#T'", $$);
else if (TREE_CODE ($$) == UNION_TYPE
&& current_aggr != union_type_node)
cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$);
else if (TREE_CODE ($$) == RECORD_TYPE)
/* We might be specializing a template with a different
class-key; deal. */
CLASSTYPE_DECLARED_CLASS ($$) = (current_aggr
== class_type_node);
if ($3)
if ($1 != error_mark_node)
{
maybe_process_partial_specialization ($$);
xref_basetypes (current_aggr, $1, $$, $3);
pop_scope (CP_DECL_CONTEXT ($1));
$$ = TREE_TYPE ($1);
if (current_aggr == union_type_node
&& TREE_CODE ($$) != UNION_TYPE)
cp_pedwarn ("`union' tag used in declaring `%#T'", $$);
else if (TREE_CODE ($$) == UNION_TYPE
&& current_aggr != union_type_node)
cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$);
else if (TREE_CODE ($$) == RECORD_TYPE)
/* We might be specializing a template with a different
class-key; deal. */
CLASSTYPE_DECLARED_CLASS ($$) = (current_aggr
== class_type_node);
if ($3)
{
maybe_process_partial_specialization ($$);
xref_basetypes (current_aggr, $1, $$, $3);
}
}
}
;
......
......@@ -2700,7 +2700,7 @@ tree
build_dummy_object (type)
tree type;
{
tree decl = build1 (NOP_EXPR, build_pointer_type (type), error_mark_node);
tree decl = build1 (NOP_EXPR, build_pointer_type (type), void_zero_node);
return build_indirect_ref (decl, NULL_PTR);
}
......@@ -2743,7 +2743,7 @@ is_dummy_object (ob)
if (TREE_CODE (ob) == INDIRECT_REF)
ob = TREE_OPERAND (ob, 0);
return (TREE_CODE (ob) == NOP_EXPR
&& TREE_OPERAND (ob, 0) == error_mark_node);
&& TREE_OPERAND (ob, 0) == void_zero_node);
}
/* Returns 1 iff type T is a POD type, as defined in [basic.types]. */
......
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