| 1 |
// PR c++/96917 |
| 2 |
// { dg-do compile { target c++14 } } |
| 3 |
|
| 4 |
int main() { |
| 5 |
int x = 0; |
| 6 |
int y = 0; |
| 7 |
const int cx = 0; |
| 8 |
const int cy = 0; |
| 9 |
|
| 10 |
[x, &y, cx, &cy] { |
| 11 |
decltype(auto) a = x; |
| 12 |
using ty1 = int; |
| 13 |
using ty1 = decltype(x); |
| 14 |
using ty1 = decltype(a); |
| 15 |
|
| 16 |
decltype(auto) b = y; |
| 17 |
using ty2 = int; |
| 18 |
using ty2 = decltype(y); |
| 19 |
using ty2 = decltype(b); |
| 20 |
|
| 21 |
decltype(auto) ca = cx; |
| 22 |
using ty3 = const int; |
| 23 |
using ty3 = decltype(cx); |
| 24 |
using ty3 = decltype(ca); |
| 25 |
|
| 26 |
decltype(auto) cb = cy; |
| 27 |
using ty4 = const int; |
| 28 |
using ty4 = decltype(cy); |
| 29 |
using ty4 = decltype(cb); |
| 30 |
}; |
| 31 |
|
| 32 |
[x=x, &y=y, cx=cx, &cy=cy] { |
| 33 |
decltype(auto) a = x; |
| 34 |
using ty1 = int; |
| 35 |
using ty1 = decltype(x); |
| 36 |
using ty1 = decltype(a); |
| 37 |
|
| 38 |
decltype(auto) b = y; |
| 39 |
using ty2 = int&; |
| 40 |
using ty2 = decltype(y); |
| 41 |
using ty2 = decltype(b); |
| 42 |
|
| 43 |
decltype(auto) ca = cx; |
| 44 |
using ty3 = int; |
| 45 |
using ty3 = decltype(cx); |
| 46 |
using ty3 = decltype(ca); |
| 47 |
|
| 48 |
decltype(auto) cb = cy; |
| 49 |
using ty4 = const int&; |
| 50 |
using ty4 = decltype(cy); |
| 51 |
using ty4 = decltype(cb); |
| 52 |
}; |
| 53 |
} |