Fix test-suite fallout of default -Wreturn-type.
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.mike / eh1.C
blob98191a20bc5c2b8cbedbfec101305b19c1721120
1 // { dg-do assemble  }
2 // { dg-options "-fexceptions -O -S" }
4 extern "C" int printf (const char *, ...);
5 extern "C" int atoi (const char *);
6 extern "C" void exit (int);
8 struct Exception
9  {
10      int v;
11      Exception(int i) { v = i; };
12  };
14  void inc(int &i)
15  {
16      try {
17          if (i == 0)
18              throw Exception(i);
19          else
20              i++;
21      }
22      catch (Exception v) {
23          i = v.v;
24      }
25  }
27 int
28 main (int argc, const char *argv[])
30   if (argc != 2)
31     {
32       printf ("usage: a.out <num>\n");
33       exit (1);
34     }
35   int count = atoi (argv[1]);
36   inc (count);
37   printf ("success\n");
38   exit (0);