[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / PR12361.cpp
blob95ceb45b7ba04a8110b02019f5cf818081a97d12
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s
4 class D {
5 class E{
6 class F{}; // expected-note{{implicitly declared private here}}
7 friend void foo(D::E::F& q);
8 };
9 friend void foo(D::E::F& q); // expected-error{{'F' is a private member of 'D::E'}}
12 void foo(D::E::F& q) {}
14 class D1 {
15 class E1{
16 class F1{}; // expected-note{{implicitly declared private here}}
17 friend D1::E1::F1 foo1();
19 friend D1::E1::F1 foo1(); // expected-error{{'F1' is a private member of 'D1::E1'}}
22 D1::E1::F1 foo1() { return D1::E1::F1(); }
24 class D2 {
25 class E2{
26 class F2{};
27 friend void foo2();
29 friend void foo2(){ D2::E2::F2 c;}