xref: /llvm-project/clang/test/CXX/except/except.spec/p13-friend.cpp (revision f061a395ffb78215a23e0f503e8ea121ee3b13ad)
1 // RUN: %clang_cc1 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
2 
3 namespace N0 {
4   void f() noexcept;
5   void g() noexcept;
6 
7   struct A {
8     friend void f() noexcept;
9     friend void g() noexcept(x);
10 
11     static constexpr bool x = true;
12   };
13 } // namespace N0
14 
15 namespace N1 {
16   void f() noexcept;
17   void g();
18 
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}}
26   };
27 
28   template struct A<int>; // expected-note {{in instantiation of template class}}
29 } // namespace N1
30