PR c++/86728 - C variadic generic lambda.
[official-gcc.git] / gcc / testsuite / g++.dg / init / ref9.C
blob127b7d8e1fd327ae96d4cea4d51a918c92c1647b
1 // { dg-do run }
3 struct ex;
4 struct basic {
5   int refcount;
6   ex eval() const;
7   basic() : refcount(0) {}
8 };
10 struct ex {
11   basic *bp;
12   ex() : bp(0) { }
13   ex(const basic &);
14   virtual ~ex();
15   void construct_from_basic(const basic &);
18 ex basic::eval() const {
19   throw 1;
22 inline ex::ex(const basic &b) { construct_from_basic (b); }
23 inline ex::~ex() { if (--bp->refcount == 0) delete bp; }
24 void ex::construct_from_basic(const basic &b) {
25   const ex & tmpex = b.eval();
26   bp = tmpex.bp;
27   bp->refcount++;
30 ex pow() { return basic(); }
32 int main()
34   try { pow (); } catch (int) {}
35   return 0;