summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-1y.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-1y.cpp')
-rw-r--r--clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-1y.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-1y.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-1y.cpp
new file mode 100644
index 00000000000..79ee76f0258
--- /dev/null
+++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-1y.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++1y %s -verify
+
+int a;
+int &b = [] (int &r) -> decltype(auto) { return r; } (a);
+int &c = [] (int &r) -> decltype(auto) { return (r); } (a);
+int &d = [] (int &r) -> auto & { return r; } (a);
+int &e = [] (int &r) -> auto { return r; } (a); // expected-error {{cannot bind to a temporary}}
+int &f = [] (int r) -> decltype(auto) { return r; } (a); // expected-error {{cannot bind to a temporary}}
+int &g = [] (int r) -> decltype(auto) { return (r); } (a); // expected-warning {{reference to stack}}
OpenPOWER on IntegriCloud