summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-01-04 02:40:39 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-01-04 02:40:39 +0000
commitc7c97144afcb8a7ceeadd3d56ee0b25acd43856b (patch)
treef46bd2ff2dea61e99cae041908811228d230f1bd /clang/test
parentcc1d7893d6e80ac3aa9240df01bdda50ece48db8 (diff)
downloadbcm5719-llvm-c7c97144afcb8a7ceeadd3d56ee0b25acd43856b.tar.gz
bcm5719-llvm-c7c97144afcb8a7ceeadd3d56ee0b25acd43856b.zip
Stub out the Sema interface for lambda expressions, and change the parser to use it. Unconditionally error on lambda expressions because they don't work in any meaningful way yet.
llvm-svn: 147515
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Parser/cxx0x-attributes.cpp2
-rw-r--r--clang/test/Parser/cxx0x-lambda-expressions.cpp14
-rw-r--r--clang/test/Parser/objcxx0x-lambda-expressions.mm12
-rw-r--r--clang/test/SemaCXX/cxx98-compat.cpp3
4 files changed, 16 insertions, 15 deletions
diff --git a/clang/test/Parser/cxx0x-attributes.cpp b/clang/test/Parser/cxx0x-attributes.cpp
index e762b57a93d..ff9118a0e15 100644
--- a/clang/test/Parser/cxx0x-attributes.cpp
+++ b/clang/test/Parser/cxx0x-attributes.cpp
@@ -20,7 +20,7 @@ int scope_attr [[foo::]]; // expected-error {{expected identifier}}
unsigned [[]] int attr_in_decl_spec; // expected-error {{expected unqualified-id}}
int & [[]] ref_attr = after_attr; // expected-error {{an attribute list cannot appear here}}
class foo {
- void after_const_attr () const [[]]; // expected-error {{expected body of lambda expression}} expected-error {{array has incomplete element type 'void'}}
+ void after_const_attr () const [[]]; // expected-error {{expected body of lambda expression}}
};
extern "C++" [[]] { } // expected-error {{an attribute list cannot appear here}}
[[]] template <typename T> void before_template_attr (); // expected-error {{an attribute list cannot appear here}}
diff --git a/clang/test/Parser/cxx0x-lambda-expressions.cpp b/clang/test/Parser/cxx0x-lambda-expressions.cpp
index 4fa4e6f1b99..df8d804931d 100644
--- a/clang/test/Parser/cxx0x-lambda-expressions.cpp
+++ b/clang/test/Parser/cxx0x-lambda-expressions.cpp
@@ -12,13 +12,13 @@ class C {
[&this] {}; // expected-error {{'this' cannot be captured by reference}}
[&,] {}; // expected-error {{expected variable name or 'this' in lambda capture list}}
[=,] {}; // expected-error {{expected variable name or 'this' in lambda capture list}}
- [] {};
- [=] (int i) {};
- [&] (int) mutable -> void {};
- [foo,bar] () { return 3; };
- [=,&foo] () {};
- [&,foo] () {};
- [this] () {};
+ [] {}; // expected-error {{lambda expressions are not supported yet}}
+ [=] (int i) {}; // expected-error {{lambda expressions are not supported yet}}
+ [&] (int) mutable -> void {}; // expected-error {{lambda expressions are not supported yet}}
+ [foo,bar] () { return 3; }; // expected-error {{lambda expressions are not supported yet}}
+ [=,&foo] () {}; // expected-error {{lambda expressions are not supported yet}}
+ [&,foo] () {}; // expected-error {{lambda expressions are not supported yet}}
+ [this] () {}; // expected-error {{lambda expressions are not supported yet}}
return 1;
}
diff --git a/clang/test/Parser/objcxx0x-lambda-expressions.mm b/clang/test/Parser/objcxx0x-lambda-expressions.mm
index 937464918b6..b9a96d6b2df 100644
--- a/clang/test/Parser/objcxx0x-lambda-expressions.mm
+++ b/clang/test/Parser/objcxx0x-lambda-expressions.mm
@@ -11,15 +11,15 @@ class C {
[]; // expected-error {{expected body of lambda expression}}
[=,foo+] {}; // expected-error {{expected ',' or ']' in lambda capture list}}
[&this] {}; // expected-error {{address expression must be an lvalue}}
- [] {};
- [=] (int i) {};
- [&] (int) mutable -> void {};
+ [] {}; // expected-error {{lambda expressions are not supported yet}}
+ [=] (int i) {}; // expected-error {{lambda expressions are not supported yet}}
+ [&] (int) mutable -> void {}; // expected-error {{lambda expressions are not supported yet}}
// FIXME: this error occurs because we do not yet handle lambda scopes
// properly. I did not anticipate it because I thought it was a semantic (not
// syntactic) check.
- [foo,bar] () { return 3; }; // expected-error {{void function 'f' should not return a value}}
- [=,&foo] () {};
- [this] () {};
+ [foo,bar] () { return 3; }; // expected-error {{void function 'f' should not return a value}} expected-error {{lambda expressions are not supported yet}}
+ [=,&foo] () {}; // expected-error {{lambda expressions are not supported yet}}
+ [this] () {}; // expected-error {{lambda expressions are not supported yet}}
}
};
diff --git a/clang/test/SemaCXX/cxx98-compat.cpp b/clang/test/SemaCXX/cxx98-compat.cpp
index 051176bf9c3..56e64d23a6e 100644
--- a/clang/test/SemaCXX/cxx98-compat.cpp
+++ b/clang/test/SemaCXX/cxx98-compat.cpp
@@ -34,7 +34,8 @@ namespace TemplateParsing {
}
void Lambda() {
- []{}; // expected-warning {{lambda expressions are incompatible with C++98}}
+ // FIXME: Enable when lambdas are minimally working.
+ //[]{}; // FIXME-warning {{lambda expressions are incompatible with C++98}}
}
int InitList() {
OpenPOWER on IntegriCloud