[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CXX / except / except.spec / p5-virtual.cpp
blob69daec6ee533479f5c4ab7d3b093e4382399cb28
1 // RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
3 // Compatibility of virtual functions.
5 struct A
7 };
9 struct B1 : A
13 struct B2 : A
17 struct D : B1, B2
21 struct P : private A
25 struct Base
27 virtual void f1() throw();
28 virtual void f2() throw(int, float);
30 virtual void f3() throw(int, float);
31 virtual void f4() throw(A);
32 virtual void f5() throw(A, int, float);
33 virtual void f6();
35 virtual void f7() noexcept;
36 virtual void f8() noexcept;
37 virtual void f9() noexcept(false);
38 virtual void f10() noexcept(false);
40 virtual void f11() throw();
41 virtual void f12() noexcept;
42 virtual void f13() noexcept(false);
43 virtual void f14() throw(int);
45 virtual void f15();
46 virtual void f16();
48 virtual void g1() throw(); // expected-note {{overridden virtual function is here}}
49 virtual void g2() throw(int); // expected-note {{overridden virtual function is here}}
50 virtual void g3() throw(A); // expected-note {{overridden virtual function is here}}
51 virtual void g4() throw(B1); // expected-note {{overridden virtual function is here}}
52 virtual void g5() throw(A); // expected-note {{overridden virtual function is here}}
54 virtual void g6() noexcept; // expected-note {{overridden virtual function is here}}
55 virtual void g7() noexcept; // expected-note {{overridden virtual function is here}}
57 virtual void g8() noexcept; // expected-note {{overridden virtual function is here}}
58 virtual void g9() throw(); // expected-note {{overridden virtual function is here}}
59 virtual void g10() throw(int); // expected-note {{overridden virtual function is here}}
61 struct Derived : Base
63 virtual void f1() throw();
64 virtual void f2() throw(float, int);
66 virtual void f3() throw(float);
67 virtual void f4() throw(B1);
68 virtual void f5() throw(B1, B2, int);
69 virtual void f6() throw(B2, B2, int, float, char, double, bool);
71 virtual void f7() noexcept;
72 virtual void f8() noexcept(true);
73 virtual void f9() noexcept(true);
74 virtual void f10() noexcept(false);
76 virtual void f11() noexcept;
77 virtual void f12() throw();
78 virtual void f13() throw(int);
79 virtual void f14() noexcept(true);
81 virtual void f15() noexcept;
82 virtual void f16() throw();
84 virtual void g1() throw(int); // expected-error {{exception specification of overriding function is more lax}}
85 virtual void g2(); // expected-error {{exception specification of overriding function is more lax}}
86 virtual void g3() throw(D); // expected-error {{exception specification of overriding function is more lax}}
87 virtual void g4() throw(A); // expected-error {{exception specification of overriding function is more lax}}
88 virtual void g5() throw(P); // expected-error {{exception specification of overriding function is more lax}}
90 virtual void g6() noexcept(false); // expected-error {{exception specification of overriding function is more lax}}
91 virtual void g7(); // expected-error {{exception specification of overriding function is more lax}}
93 virtual void g8() throw(int); // expected-error {{exception specification of overriding function is more lax}}
94 virtual void g9() noexcept(false); // expected-error {{exception specification of overriding function is more lax}}
95 virtual void g10() noexcept(false); // expected-error {{exception specification of overriding function is more lax}}