cp-tree.h (PTRMEM_CST_CLASS): Fix typo.
* cp-tree.h (PTRMEM_CST_CLASS): Fix typo. (global_delete_fndecl): New variable. * decl.c (global_delete_fndecl): Define it. (init_decl_processing): Set it. * init.c (build_builtin_delete_call): Use it. * tree.c (mapcar): Recursively call mapcar for the type of EXPR nodes. From-SVN: r23699
This commit is contained in:
parent
ef18065c0a
commit
94e098d112
@ -1,3 +1,13 @@
|
||||
1998-11-18 Mark Mitchell <mark@markmitchell.com>
|
||||
|
||||
* cp-tree.h (PTRMEM_CST_CLASS): Fix typo.
|
||||
(global_delete_fndecl): New variable.
|
||||
* decl.c (global_delete_fndecl): Define it.
|
||||
(init_decl_processing): Set it.
|
||||
* init.c (build_builtin_delete_call): Use it.
|
||||
* tree.c (mapcar): Recursively call mapcar for the type of EXPR
|
||||
nodes.
|
||||
|
||||
1998-11-18 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* decl.c (cplus_expand_expr_stmt): Always complain about unresolved
|
||||
|
@ -1623,9 +1623,9 @@ extern int flag_new_for_scope;
|
||||
|
||||
/* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for
|
||||
`X'. */
|
||||
#define PTRMEM_CST_CLASS(NODE) \
|
||||
(TYPE_PTRMEM_P (TREE_TYPE (NODE)) \
|
||||
? TYPE_OFFSET_BASETYPE (TREE_TYPE (NODE)) \
|
||||
#define PTRMEM_CST_CLASS(NODE) \
|
||||
(TYPE_PTRMEM_P (TREE_TYPE (NODE)) \
|
||||
? TYPE_OFFSET_BASETYPE (TREE_TYPE (TREE_TYPE (NODE))) \
|
||||
: TYPE_PTRMEMFUNC_OBJECT_TYPE (TREE_TYPE (NODE)))
|
||||
|
||||
/* For a pointer-to-member constant `X::Y' this is the _DECL for
|
||||
@ -2060,6 +2060,10 @@ extern tree null_node;
|
||||
|
||||
extern tree anonymous_namespace_name;
|
||||
|
||||
/* The FUNCTION_DECL for the default `::operator delete'. */
|
||||
|
||||
extern tree global_delete_fndecl;
|
||||
|
||||
/* in pt.c */
|
||||
|
||||
/* These values are used for the `STRICT' parameter to type_unfication and
|
||||
|
@ -374,6 +374,10 @@ tree ctor_label;
|
||||
|
||||
tree abort_fndecl;
|
||||
|
||||
/* A FUNCTION_DECL for the default `::operator delete'. */
|
||||
|
||||
tree global_delete_fndecl;
|
||||
|
||||
extern rtx cleanup_label, return_label;
|
||||
|
||||
/* If original DECL_RESULT of current function was a register,
|
||||
@ -6325,7 +6329,8 @@ init_decl_processing ()
|
||||
(void_ftype_ptr, build_tree_list (NULL_TREE, NULL_TREE));
|
||||
auto_function (ansi_opname[(int) NEW_EXPR], newtype, NOT_BUILT_IN);
|
||||
auto_function (ansi_opname[(int) VEC_NEW_EXPR], newtype, NOT_BUILT_IN);
|
||||
auto_function (ansi_opname[(int) DELETE_EXPR], deltype, NOT_BUILT_IN);
|
||||
global_delete_fndecl
|
||||
= auto_function (ansi_opname[(int) DELETE_EXPR], deltype, NOT_BUILT_IN);
|
||||
auto_function (ansi_opname[(int) VEC_DELETE_EXPR], deltype, NOT_BUILT_IN);
|
||||
}
|
||||
|
||||
|
@ -1862,11 +1862,9 @@ static tree
|
||||
build_builtin_delete_call (addr)
|
||||
tree addr;
|
||||
{
|
||||
tree BID = get_first_fn
|
||||
(IDENTIFIER_GLOBAL_VALUE (ansi_opname[(int) DELETE_EXPR]));
|
||||
|
||||
assemble_external (BID);
|
||||
return build_call (BID, void_type_node, build_expr_list (NULL_TREE, addr));
|
||||
assemble_external (global_delete_fndecl);
|
||||
return build_call (global_delete_fndecl,
|
||||
void_type_node, build_expr_list (NULL_TREE, addr));
|
||||
}
|
||||
|
||||
/* Generate a C++ "new" expression. DECL is either a TREE_LIST
|
||||
|
@ -1935,6 +1935,7 @@ mapcar (t, func)
|
||||
case COMPONENT_REF:
|
||||
case CLEANUP_POINT_EXPR:
|
||||
t = copy_node (t);
|
||||
TREE_TYPE (t) = mapcar (TREE_TYPE (t), func);
|
||||
TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
|
||||
return t;
|
||||
|
||||
|
38
gcc/testsuite/g++.old-deja/g++.other/delete3.C
Normal file
38
gcc/testsuite/g++.old-deja/g++.other/delete3.C
Normal file
@ -0,0 +1,38 @@
|
||||
#include <new>
|
||||
|
||||
int i;
|
||||
|
||||
extern "C" void printf(const char*, ...);
|
||||
|
||||
template <class T, class U>
|
||||
struct map {
|
||||
~map ();
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
map<T, U>::~map ()
|
||||
{}
|
||||
|
||||
struct SomeClass { };
|
||||
|
||||
void* operator new(size_t numBytes, SomeClass&, const nothrow_t&) throw()
|
||||
{
|
||||
return operator new(numBytes, nothrow);
|
||||
}
|
||||
|
||||
void operator delete(void* pMemory, SomeClass&, const nothrow_t&) throw()
|
||||
{
|
||||
i = 7;
|
||||
return operator delete(pMemory);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
map< int, int>* pMap = new map< int, int>;
|
||||
|
||||
delete pMap;
|
||||
|
||||
if (i == 7)
|
||||
return 1;
|
||||
}
|
Loading…
Reference in New Issue
Block a user