diff options
Diffstat (limited to 'test/CXX/expr/expr.prim')
| -rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p15-star-this-capture.cpp | 22 | ||||
| -rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp | 4 |
2 files changed, 24 insertions, 2 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p15-star-this-capture.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p15-star-this-capture.cpp new file mode 100644 index 000000000000..eac6c40c6085 --- /dev/null +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p15-star-this-capture.cpp @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++1z %s -verify + +class NonCopyable { + NonCopyable(const NonCopyable&) = delete; //expected-note3{{explicitly marked deleted here}} + int x = 10; + void foo() { + auto L = [this] { return x; }; + const auto &M = [*this] { return x; };//expected-error{{call to deleted}} + const auto &M2 = [this] () -> auto&& { + ++x; + return [*this] { //expected-error{{call to deleted}} expected-warning{{reference to local}} + return ++x; //expected-error{{read-only}} + }; + }; + const auto &M3 = [*this] () mutable -> auto&& { //expected-error{{call to deleted}} + ++x; + return [this] { // expected-warning{{reference to local}} + return x; + }; + }; + } +}; diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp index dc2c209af268..b8504d490650 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp @@ -11,7 +11,7 @@ void test_attributes() { template<typename T> struct bogus_override_if_virtual : public T { - bogus_override_if_virtual() : T(*(T*)0) { } + bogus_override_if_virtual() : T(*(T*)0) { } // expected-warning {{binding dereferenced null pointer to reference has undefined behavior}} int operator()() const; }; @@ -36,7 +36,7 @@ void test_quals() { lv(); // expected-error{{no matching function for call to object of type}} mlv(); // expected-error{{no matching function for call to object of type}} - bogus_override_if_virtual<decltype(l)> bogus; + bogus_override_if_virtual<decltype(l)> bogus; // expected-note{{in instantiation of member function 'bogus_override_if_virtual<(lambda}} } // Core issue 974: default arguments (8.3.6) may be specified in the |
