summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.law/except6.C
blob: 05f54e60a1030dfd6ad2aaf7f827153add4082cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// { dg-do assemble  }
// { dg-options "-fexceptions" }
// GROUPS passed exceptions
// except file
// From: GUSTAVO%DRAGON@orion.cpqd.ansp.br
// Date:     15 Dec 1993 09:33:30 +0000 (C)
// Subject:  exception handling problem
// Message-ID: <01H6I5GEAF5UPBJ0UV@VENUS.CPQD.ANSP.BR>

struct Exception
 {
     int v;
     Exception(int i) { v = i; };
 };

void inc(int &i)
 {
     try {
         if (i == 0)
             throw Exception(i);
         else
             i++;
     }
     catch (Exception v) {
         i = v.v;
     }
 }