PR c++/56973, DR 696 - capture constant variables only as needed.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / auto-fn17.C
blob1647107e54a0240222b2eb95cdb36b43b1a5d253
1 // { dg-do run { target c++14 } }
3 int c;
4 int d;
6 struct A
8   A() { ++c; }
9   A(const A&) { ++c; }
10   ~A() { ++d; }
13 A g() { return A(); }
14 decltype(auto) f() { return g(); }
16 int main()
18   f();
19   if (c < 1 || c != d)
20     __builtin_abort ();