1/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
2/* { dg-options "-fobjc-exceptions" } */
3/* { dg-do compile } */
4
5/* Test warnings when the argument of @throw is invalid.  */
6
7#include <objc/objc.h>
8
9void test (id object)
10{
11  struct x { int i; } invalid_1, *invalid_2;
12
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" } */
18}
19