* 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
+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
/* 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
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
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,
(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);
}
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));
}
\f
/* Generate a C++ "new" expression. DECL is either a TREE_LIST
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;
--- /dev/null
+#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;
+}