gcc/testsuite/g++.dg/cpp1y/decltype-auto8.C
raw| 1 | // PR c++/115504 |
| 2 | // { dg-do compile { target c++14 } } |
| 3 | |
| 4 | void f(int& x, const int& y) { |
| 5 | [&x]() { |
| 6 | decltype(auto) a = x; |
| 7 | using type = decltype(x); |
| 8 | using type = decltype(a); |
| 9 | using type = int&; // not 'int' |
| 10 | }; |
| 11 | |
| 12 | [x]() { |
| 13 | decltype(auto) a = x; // { dg-error "discards qualifiers" } |
| 14 | }; |
| 15 | |
| 16 | [x]() mutable { |
| 17 | decltype(auto) a = x; |
| 18 | using type = decltype(x); |
| 19 | using type = decltype(a); |
| 20 | using type = int&; |
| 21 | }; |
| 22 | } |