summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/exceptions-7.m
diff options
context:
space:
mode:
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-08 23:46:28 +0000
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-08 23:46:28 +0000
commit40ec327c484f09c7fc9c11e5633101cfc391683c (patch)
treeff57e0beed9ef0ff7353af054bd1a49d3e4061e6 /gcc/testsuite/objc.dg/exceptions-7.m
parent363add13cad3ec829f076917d47d6937467e7750 (diff)
downloadgcc-40ec327c484f09c7fc9c11e5633101cfc391683c.tar.gz
In gcc/objc/:
2010-12-08 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_build_throw_stmt): Check that the argument of @throw is an object and emit an error if not. In gcc/testsuite/: 2010-12-08 Nicola Pero <nicola.pero@meta-innovation.com> * objc.dg/exceptions-7.m: New. * obj-c++.dg/exceptions-7.mm: New. * obj-c++.dg/exceptions-3.mm: Adjust for new C++ messages. * obj-c++.dg/exceptions-5.mm: Same change. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167615 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/objc.dg/exceptions-7.m')
-rw-r--r--gcc/testsuite/objc.dg/exceptions-7.m18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/exceptions-7.m b/gcc/testsuite/objc.dg/exceptions-7.m
new file mode 100644
index 00000000000..1f5adfc8906
--- /dev/null
+++ b/gcc/testsuite/objc.dg/exceptions-7.m
@@ -0,0 +1,18 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010. */
+/* { dg-options "-fobjc-exceptions" } */
+/* { dg-do compile } */
+
+/* Test warnings when the argument of @throw is invalid. */
+
+#include <objc/objc.h>
+
+void test (id object)
+{
+ struct x { int i; } invalid_1, *invalid_2;
+
+ @throw object; /* Ok */
+ @throw 1; /* { dg-error ".@throw. argument is not an object" } */
+ @throw "string"; /* { dg-error ".@throw. argument is not an object" } */
+ @throw invalid_1; /* { dg-error ".@throw. argument is not an object" } */
+ @throw invalid_2; /* { dg-error ".@throw. argument is not an object" } */
+}