Faisal Vali | dc6b596 | 2016-03-21 09:25:37 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -std=c++1z %s -verify
|
| 2 |
|
| 3 | class NonCopyable {
|
| 4 | NonCopyable(const NonCopyable&) = delete; //expected-note3{{explicitly marked deleted here}}
|
| 5 | int x = 10;
|
| 6 | void foo() {
|
| 7 | auto L = [this] { return x; };
|
| 8 | const auto &M = [*this] { return x; };//expected-error{{call to deleted}}
|
| 9 | const auto &M2 = [this] () -> auto&& {
|
| 10 | ++x;
|
| 11 | return [*this] { //expected-error{{call to deleted}} expected-warning{{reference to local}}
|
| 12 | return ++x; //expected-error{{read-only}}
|
| 13 | };
|
| 14 | };
|
| 15 | const auto &M3 = [*this] () mutable -> auto&& { //expected-error{{call to deleted}}
|
| 16 | ++x;
|
| 17 | return [this] { // expected-warning{{reference to local}}
|
| 18 | return x;
|
| 19 | };
|
| 20 | };
|
| 21 | }
|
| 22 | };
|