1// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
2
3// The object declared in an exception-declaration or, if the
4// exception-declaration does not specify a name, a temporary (12.2)
5// is copy-initialized (8.5) from the exception object.
6//
7template<typename T>
8class X {
9  T* ptr;
10
11public:
12  X(const X<T> &) {
13    int *ip = 0;
14    ptr = ip; // expected-error{{assigning to 'float *' from incompatible type 'int *'}}
15  }
16
17  ~X() {
18    float *fp = 0;
19    ptr = fp; // expected-error{{assigning to 'int *' from incompatible type 'float *'}}
20  }
21};
22
23void f() {
24  try {
25  } catch (X<float>) { // expected-note{{instantiation}}
26    // copy constructor
27  } catch (X<int> xi) { // expected-note{{instantiation}}
28    // destructor
29  }
30}
31
32struct Abstract {
33  virtual void f() = 0; // expected-note{{pure virtual}}
34};
35
36void g() {
37  try {
38  } catch (Abstract) { // expected-error{{variable type 'Abstract' is an abstract class}}
39  }
40}
41