aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-11-18 17:58:33 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-11-18 17:58:33 +0000
commit94e098d11228f5c3caade657a9f8254336494fb6 (patch)
tree7d6c738147d9114ea0021ad92cfd6edbfef6f4db /gcc
parentef18065c0ad435acad2bb2562d53a3d5db6c731f (diff)
downloadgcc-94e098d11228f5c3caade657a9f8254336494fb6.zip
gcc-94e098d11228f5c3caade657a9f8254336494fb6.tar.gz
gcc-94e098d11228f5c3caade657a9f8254336494fb6.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/cp-tree.h10
-rw-r--r--gcc/cp/decl.c7
-rw-r--r--gcc/cp/init.c8
-rw-r--r--gcc/cp/tree.c1
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/delete3.C38
6 files changed, 65 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7f2dd89..5f56a03 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 99cb2d9..340d992 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -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
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 9feae32..8980c11 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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);
}
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index c7df0b0..76271b7 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -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
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index efbf6b2..a94d9f7 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -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;
diff --git a/gcc/testsuite/g++.old-deja/g++.other/delete3.C b/gcc/testsuite/g++.old-deja/g++.other/delete3.C
new file mode 100644
index 0000000..eb56350
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/delete3.C
@@ -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;
+}