brintos

brintos / llvm-project-archived public Read only

0
0
Text · 739 B · 69974fc Raw
23 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -std=c++1z %s -verify2 3class 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};23