Commit a06d48ef by Jason Merrill

decl.c (push_local_binding): Also wrap used decls in a TREE_LIST.

	* decl.c (push_local_binding): Also wrap used decls in a TREE_LIST.
	(poplevel): Handle that.  Fix logic for removing TREE_LISTs.
	(cat_namespace_levels): Don't loop forever.
Fixes 733Y14.
	* typeck.c (build_reinterpret_cast): Fix typo in duplicated test.

From-SVN: r24867
parent 9602dbfb
1999-01-26 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (push_local_binding): Also wrap used decls in a TREE_LIST.
(poplevel): Handle that. Fix logic for removing TREE_LISTs.
(cat_namespace_levels): Don't loop forever.
1999-01-25 Richard Henderson <rth@cygnus.com>
* typeck.c (build_reinterpret_cast): Fix typo in duplicated test.
1999-01-25 Jason Merrill <jason@yorick.cygnus.com> 1999-01-25 Jason Merrill <jason@yorick.cygnus.com>
* class.c (resolve_address_of_overloaded_function): Mark the * class.c (resolve_address_of_overloaded_function): Mark the
......
...@@ -1126,18 +1126,20 @@ push_local_binding (id, decl) ...@@ -1126,18 +1126,20 @@ push_local_binding (id, decl)
{ {
tree d = decl; tree d = decl;
if (TREE_CODE (decl) == OVERLOAD)
/* We must put the OVERLOAD into a TREE_LIST since the
TREE_CHAIN of an OVERLOAD is already used. */
decl = build_tree_list (NULL_TREE, decl);
if (lookup_name_current_level (id)) if (lookup_name_current_level (id))
/* Supplement the existing binding. */ /* Supplement the existing binding. */
add_binding (id, decl); add_binding (id, d);
else else
/* Create a new binding. */ /* Create a new binding. */
push_binding (id, d, current_binding_level); push_binding (id, d, current_binding_level);
if (TREE_CODE (decl) == OVERLOAD
|| (DECL_P (decl) && DECL_NAMESPACE_SCOPE_P (decl)))
/* We must put the OVERLOAD into a TREE_LIST since the
TREE_CHAIN of an OVERLOAD is already used. Similarly for
decls that got here through a using-declaration. */
decl = build_tree_list (NULL_TREE, decl);
/* And put DECL on the list of things declared by the current /* And put DECL on the list of things declared by the current
binding level. */ binding level. */
TREE_CHAIN (decl) = current_binding_level->names; TREE_CHAIN (decl) = current_binding_level->names;
...@@ -1423,11 +1425,12 @@ poplevel (keep, reverse, functionbody) ...@@ -1423,11 +1425,12 @@ poplevel (keep, reverse, functionbody)
else else
{ {
/* Remove the binding. */ /* Remove the binding. */
if (TREE_CODE (link) == TREE_LIST)
link = TREE_VALUE (link);
if (TREE_CODE_CLASS (TREE_CODE (link)) == 'd') if (TREE_CODE_CLASS (TREE_CODE (link)) == 'd')
pop_binding (DECL_NAME (link), link); pop_binding (DECL_NAME (link), link);
else if (TREE_CODE (link) == TREE_LIST) else if (TREE_CODE (link) == OVERLOAD)
pop_binding (DECL_NAME (OVL_FUNCTION (TREE_VALUE (link))), pop_binding (DECL_NAME (OVL_FUNCTION (link)), link);
TREE_VALUE (link));
else else
my_friendly_abort (0); my_friendly_abort (0);
} }
...@@ -1454,11 +1457,13 @@ poplevel (keep, reverse, functionbody) ...@@ -1454,11 +1457,13 @@ poplevel (keep, reverse, functionbody)
{ {
tree* d; tree* d;
for (d = &BLOCK_VARS (block); for (d = &BLOCK_VARS (block); *d; )
*d; {
d = *d ? &TREE_CHAIN (*d) : d) if (TREE_CODE (*d) == TREE_LIST)
if (TREE_CODE (*d) == TREE_LIST) *d = TREE_CHAIN (*d);
*d = TREE_CHAIN (*d); else
d = &TREE_CHAIN (*d);
}
} }
/* If the level being exited is the top level of a function, /* If the level being exited is the top level of a function,
...@@ -2078,6 +2083,10 @@ cat_namespace_levels() ...@@ -2078,6 +2083,10 @@ cat_namespace_levels()
/* The nested namespaces appear in the names list of their ancestors. */ /* The nested namespaces appear in the names list of their ancestors. */
for (current = last; current; current = TREE_CHAIN (current)) for (current = last; current; current = TREE_CHAIN (current))
{ {
/* Catch simple infinite loops. */
if (TREE_CHAIN (current) == current)
my_friendly_abort (990126);
if (TREE_CODE (current) != NAMESPACE_DECL if (TREE_CODE (current) != NAMESPACE_DECL
|| DECL_NAMESPACE_ALIAS (current)) || DECL_NAMESPACE_ALIAS (current))
continue; continue;
......
...@@ -5485,7 +5485,7 @@ build_reinterpret_cast (type, expr) ...@@ -5485,7 +5485,7 @@ build_reinterpret_cast (type, expr)
return fold (build1 (NOP_EXPR, type, expr)); return fold (build1 (NOP_EXPR, type, expr));
} }
else if ((TYPE_PTRFN_P (type) && TYPE_PTROBV_P (intype)) else if ((TYPE_PTRFN_P (type) && TYPE_PTROBV_P (intype))
|| (TYPE_PTRFN_P (type) && TYPE_PTROBV_P (intype))) || (TYPE_PTRFN_P (intype) && TYPE_PTROBV_P (type)))
{ {
pedwarn ("ANSI C++ forbids casting between pointers to functions and objects"); pedwarn ("ANSI C++ forbids casting between pointers to functions and objects");
if (TREE_READONLY_DECL_P (expr)) if (TREE_READONLY_DECL_P (expr))
......
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