[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CXX / except / except.spec / p13-friend.cpp
blob7f73a4ff431aa922486ee92294654f3f79b1b136
1 // RUN: %clang_cc1 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
3 namespace N0 {
4 void f() noexcept;
5 void g() noexcept;
7 struct A {
8 friend void f() noexcept;
9 friend void g() noexcept(x);
11 static constexpr bool x = true;
13 } // namespace N0
15 namespace N1 {
16 void f() noexcept;
17 void g();
19 template<typename T>
20 struct A {
21 friend void f() noexcept;
22 // FIXME: This error is emitted if no other errors occured (i.e. Sema::hasUncompilableErrorOccurred() is false).
23 friend void g() noexcept(x); // expected-error {{no member 'x' in 'N1::A<int>'; it has not yet been instantiated}}
24 // expected-note@-1 {{in instantiation of exception specification}}
25 static constexpr bool x = false; // expected-note {{not-yet-instantiated member is declared here}}
28 template struct A<int>; // expected-note {{in instantiation of template class}}
29 } // namespace N1