brintos

brintos / llvm-project-archived public Read only

0
0
Text · 573 B · 096f508 Raw
19 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 2 3void f() {4  int x = 3; // expected-note{{'x' declared here}}5  const int c = 2;6  struct C {7    int& x2 = x; // expected-error{{reference to local variable 'x' declared in enclosing function 'f'}}8    int cc = c;9  };10  (void)[]() mutable {11    int x = 3; // expected-note{{'x' declared here}}12    struct C {13      int& x2 = x; // expected-error{{reference to local variable 'x' declared in enclosing lambda expression}}14    }c; // expected-note {{required here}}15  };16  C(); // expected-note {{required here}}17}18 19