aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-11-13 13:02:24 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-11-13 13:02:24 +0000
commitbbeeb2b0201c839ffc6c66f0f472b88964387e63 (patch)
tree1e272f79b98bb912af9ba20e66858052ae62f970 /gcc
parent93d9a2ebd84052bf2afe42289696023d63676b3b (diff)
downloadgcc-bbeeb2b0201c839ffc6c66f0f472b88964387e63.zip
gcc-bbeeb2b0201c839ffc6c66f0f472b88964387e63.tar.gz
gcc-bbeeb2b0201c839ffc6c66f0f472b88964387e63.tar.bz2
except.c (expand_throw): Make sure first argument to __cp_push_exception is of type `void*' to avoid...
* except.c (expand_throw): Make sure first argument to __cp_push_exception is of type `void*' to avoid spurious error messages. From-SVN: r23639
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/except.c9
-rw-r--r--gcc/testsuite/g++.old-deja/g++.eh/throw1.C12
3 files changed, 23 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 475ada1..c613d80 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+1998-11-13 Mark Mitchell <mark@markmitchell.com>
+
+ * except.c (expand_throw): Make sure first argument to
+ __cp_push_exception is of type `void*' to avoid spurious error
+ messages.
+
1998-11-11 Jason Merrill <jason@yorick.cygnus.com>
* pt.c (try_one_overload): Take orig_targs again. Only check for
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 2d069da..d2cc3e4 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -998,10 +998,7 @@ expand_throw (exp)
}
if (TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE)
- {
- throw_type = build_eh_type (exp);
- exp = build_reinterpret_cast (ptr_type_node, exp);
- }
+ throw_type = build_eh_type (exp);
else
{
tree object, ptr;
@@ -1075,6 +1072,10 @@ expand_throw (exp)
exp = ptr;
}
+ /* Cast EXP to `void *' so that it will match the prototype for
+ __cp_push_exception. */
+ exp = build_reinterpret_cast (ptr_type_node, exp);
+
if (cleanup == NULL_TREE)
{
cleanup = build_int_2 (0, 0);
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/throw1.C b/gcc/testsuite/g++.old-deja/g++.eh/throw1.C
new file mode 100644
index 0000000..49a7d1e
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.eh/throw1.C
@@ -0,0 +1,12 @@
+// Build don't link:
+
+void athrow(const int & e) throw(int)
+{
+ throw e;
+}
+
+int main(void)
+{
+ athrow(int());
+ return 0;
+}