aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1y/decltype-auto8.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp1y/decltype-auto8.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/decltype-auto8.C22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp1y/decltype-auto8.C b/gcc/testsuite/g++.dg/cpp1y/decltype-auto8.C
new file mode 100644
index 00000000000..55135cecf72
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/decltype-auto8.C
@@ -0,0 +1,22 @@
+// PR c++/115504
+// { dg-do compile { target c++14 } }
+
+void f(int& x, const int& y) {
+ [&x]() {
+ decltype(auto) a = x;
+ using type = decltype(x);
+ using type = decltype(a);
+ using type = int&; // not 'int'
+ };
+
+ [x]() {
+ decltype(auto) a = x; // { dg-error "discards qualifiers" }
+ };
+
+ [x]() mutable {
+ decltype(auto) a = x;
+ using type = decltype(x);
+ using type = decltype(a);
+ using type = int&;
+ };
+}