xref: /llvm-project/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp (revision 656bc62a73f204286c8dc21fb5ed418b9c39b2fb)
1 // RUN: %clang_cc1 -std=c++11 %s -verify
2 
3 int GlobalVar; // expected-note {{declared here}}
4 
5 namespace N {
6   int AmbiguousVar; // expected-note {{candidate}}
7 }
8 int AmbiguousVar; // expected-note {{candidate}}
9 using namespace N;
10 
11 class X0 {
12   int Member;
13 
14   static void Overload(int);
15   void Overload();
16   virtual X0& Overload(float);
17 
18   void explicit_capture() {
19     int variable; // expected-note {{declared here}}
20     (void)[&Overload] () {}; // expected-error {{does not name a variable}}
21     (void)[&GlobalVar] () {}; // expected-error {{does not have automatic storage duration}}
22     (void)[&AmbiguousVar] () {}; // expected-error {{reference to 'AmbiguousVar' is ambiguous}}
23     (void)[&Variable] () {}; // expected-error {{use of undeclared identifier 'Variable'; did you mean 'variable'}}
24   }
25 };
26