mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-27 15:28:53 -04:00

- Actually building the var -> capture mapping properly (there was an off-by-one error) - Keeping track of the source location of each capture - Minor QoI improvements, e.g, highlighing the prior capture if there are multiple captures, pointing at the variable declaration we found if we reject it. As part of this, add standard citations for the various semantic checks we perform, and note where we're not performing those checks as we should. llvm-svn: 149462
45 lines
2.1 KiB
C++
45 lines
2.1 KiB
C++
// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
|
|
|
|
namespace std { class type_info; };
|
|
|
|
namespace ExplicitCapture {
|
|
class C {
|
|
int Member;
|
|
|
|
static void Overload(int);
|
|
void Overload();
|
|
virtual C& Overload(float);
|
|
|
|
void ImplicitThisCapture() {
|
|
[](){(void)Member;}; // expected-error {{'this' cannot be implicitly captured in this context}} expected-error {{not supported yet}}
|
|
[&](){(void)Member;}; // expected-error {{not supported yet}}
|
|
// FIXME: 'this' captures below don't actually work yet
|
|
// FIXME: [this](){(void)Member;};
|
|
// FIXME: [this]{[this]{};};
|
|
[]{[this]{};};// expected-error {{'this' cannot be implicitly captured in this context}} expected-error 2 {{not supported yet}}
|
|
[]{Overload(3);}; // expected-error {{not supported yet}}
|
|
[]{Overload();}; // expected-error {{'this' cannot be implicitly captured in this context}} expected-error {{not supported yet}}
|
|
[]{(void)typeid(Overload());};// expected-error {{not supported yet}}
|
|
[]{(void)typeid(Overload(.5f));};// expected-error {{'this' cannot be implicitly captured in this context}} expected-error {{not supported yet}}
|
|
}
|
|
};
|
|
|
|
void f() {
|
|
[this] () {}; // expected-error {{invalid use of 'this'}} expected-error {{not supported yet}}
|
|
}
|
|
}
|
|
|
|
namespace ReturnDeduction {
|
|
void test() {
|
|
[](){ return 1; }; // expected-error {{not supported yet}}
|
|
[](){ return 1; }; // expected-error {{not supported yet}}
|
|
[](){ return ({return 1; 1;}); }; // expected-error {{not supported yet}}
|
|
[](){ return ({return 'c'; 1;}); }; // expected-error {{not supported yet}} expected-error {{must match previous return type}}
|
|
[]()->int{ return 'c'; return 1; }; // expected-error {{not supported yet}}
|
|
[](){ return 'c'; return 1; }; // expected-error {{not supported yet}} expected-error {{must match previous return type}}
|
|
[]() { return; return (void)0; }; // expected-error {{not supported yet}}
|
|
// FIXME: Need to check structure of lambda body
|
|
[](){ return 1; return 1; }; // expected-error {{not supported yet}}
|
|
}
|
|
}
|