From 01d08018b7cf5ce1601707cfd7a84d22015fc04e Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 7 Feb 2012 10:09:13 +0000 Subject: Introduce basic ASTs for lambda expressions. This covers: - Capturing variables by-reference and by-copy within a lambda - The representation of lambda captures - The creation of the non-static data members in the lambda class that store the captured variables - The initialization of the non-static data members from the captured variables - Pretty-printing lambda expressions There are a number of FIXMEs, both explicit and implied, including: - Creating a field for a capture of 'this' - Improved diagnostics for initialization failures when capturing variables by copy - Dealing with temporaries created during said initialization - Template instantiation - AST (de-)serialization - Binding and returning the lambda expression; turning it into a proper temporary - Lots and lots of semantic constraints - Parameter pack captures git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149977 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp (limited to 'test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp') diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp new file mode 100644 index 0000000000..0bbb9ae744 --- /dev/null +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify + +class NonCopyable { + NonCopyable(const NonCopyable&); // expected-note 2 {{implicitly declared private here}} +}; + +void capture_by_copy(NonCopyable nc, NonCopyable &ncr) { + // FIXME: error messages should talk about capture + [nc] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} \ + // expected-error{{lambda expressions are not supported yet}} + [ncr] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} \ + // expected-error{{lambda expressions are not supported yet}} +} + +// FIXME: arrays! -- cgit v1.2.3