PR target/84336
[official-gcc.git] / gcc / testsuite / objc.dg / exceptions-7.m
blob1f5adfc890607a34daf72ebc3a3ff49bfe1f7166
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
2 /* { dg-options "-fobjc-exceptions" } */
3 /* { dg-do compile } */
5 /* Test warnings when the argument of @throw is invalid.  */
7 #include <objc/objc.h>
9 void test (id object)
11   struct x { int i; } invalid_1, *invalid_2;
13   @throw object;    /* Ok */
14   @throw 1;         /* { dg-error ".@throw. argument is not an object" } */
15   @throw "string";  /* { dg-error ".@throw. argument is not an object" } */
16   @throw invalid_1; /* { dg-error ".@throw. argument is not an object" } */
17   @throw invalid_2; /* { dg-error ".@throw. argument is not an object" } */