summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.eh/ptr1.C
blob: aefe5cc618ed7be009344599d2b4b240b12ae08a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// { dg-do run  }
// Bug: catching pointers by reference doesn't work right.

extern "C" int printf (const char *, ...);

struct E {
  int x;
  E(int i) { x = i; }
};

int main()
{
  try {
    E *p = new E(5);
    throw p;
  }

  catch (E *&e) {
    printf ("address of e is 0x%lx\n", (__SIZE_TYPE__)e);
    return !((__SIZE_TYPE__)e != 5 && e->x == 5);
  }
  return 2;
}