1*67e74705SXin Li // RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s 2*67e74705SXin Li 3*67e74705SXin Li // Compatibility of virtual functions. 4*67e74705SXin Li 5*67e74705SXin Li struct A 6*67e74705SXin Li { 7*67e74705SXin Li }; 8*67e74705SXin Li 9*67e74705SXin Li struct B1 : A 10*67e74705SXin Li { 11*67e74705SXin Li }; 12*67e74705SXin Li 13*67e74705SXin Li struct B2 : A 14*67e74705SXin Li { 15*67e74705SXin Li }; 16*67e74705SXin Li 17*67e74705SXin Li struct D : B1, B2 18*67e74705SXin Li { 19*67e74705SXin Li }; 20*67e74705SXin Li 21*67e74705SXin Li struct P : private A 22*67e74705SXin Li { 23*67e74705SXin Li }; 24*67e74705SXin Li 25*67e74705SXin Li struct Base 26*67e74705SXin Li { 27*67e74705SXin Li virtual void f1() throw(); 28*67e74705SXin Li virtual void f2() throw(int, float); 29*67e74705SXin Li 30*67e74705SXin Li virtual void f3() throw(int, float); 31*67e74705SXin Li virtual void f4() throw(A); 32*67e74705SXin Li virtual void f5() throw(A, int, float); 33*67e74705SXin Li virtual void f6(); 34*67e74705SXin Li 35*67e74705SXin Li virtual void f7() noexcept; 36*67e74705SXin Li virtual void f8() noexcept; 37*67e74705SXin Li virtual void f9() noexcept(false); 38*67e74705SXin Li virtual void f10() noexcept(false); 39*67e74705SXin Li 40*67e74705SXin Li virtual void f11() throw(); 41*67e74705SXin Li virtual void f12() noexcept; 42*67e74705SXin Li virtual void f13() noexcept(false); 43*67e74705SXin Li virtual void f14() throw(int); 44*67e74705SXin Li 45*67e74705SXin Li virtual void f15(); 46*67e74705SXin Li virtual void f16(); 47*67e74705SXin Li 48*67e74705SXin Li virtual void g1() throw(); // expected-note {{overridden virtual function is here}} 49*67e74705SXin Li virtual void g2() throw(int); // expected-note {{overridden virtual function is here}} 50*67e74705SXin Li virtual void g3() throw(A); // expected-note {{overridden virtual function is here}} 51*67e74705SXin Li virtual void g4() throw(B1); // expected-note {{overridden virtual function is here}} 52*67e74705SXin Li virtual void g5() throw(A); // expected-note {{overridden virtual function is here}} 53*67e74705SXin Li 54*67e74705SXin Li virtual void g6() noexcept; // expected-note {{overridden virtual function is here}} 55*67e74705SXin Li virtual void g7() noexcept; // expected-note {{overridden virtual function is here}} 56*67e74705SXin Li 57*67e74705SXin Li virtual void g8() noexcept; // expected-note {{overridden virtual function is here}} 58*67e74705SXin Li virtual void g9() throw(); // expected-note {{overridden virtual function is here}} 59*67e74705SXin Li virtual void g10() throw(int); // expected-note {{overridden virtual function is here}} 60*67e74705SXin Li }; 61*67e74705SXin Li struct Derived : Base 62*67e74705SXin Li { 63*67e74705SXin Li virtual void f1() throw(); 64*67e74705SXin Li virtual void f2() throw(float, int); 65*67e74705SXin Li 66*67e74705SXin Li virtual void f3() throw(float); 67*67e74705SXin Li virtual void f4() throw(B1); 68*67e74705SXin Li virtual void f5() throw(B1, B2, int); 69*67e74705SXin Li virtual void f6() throw(B2, B2, int, float, char, double, bool); 70*67e74705SXin Li 71*67e74705SXin Li virtual void f7() noexcept; 72*67e74705SXin Li virtual void f8() noexcept(true); 73*67e74705SXin Li virtual void f9() noexcept(true); 74*67e74705SXin Li virtual void f10() noexcept(false); 75*67e74705SXin Li 76*67e74705SXin Li virtual void f11() noexcept; 77*67e74705SXin Li virtual void f12() throw(); 78*67e74705SXin Li virtual void f13() throw(int); 79*67e74705SXin Li virtual void f14() noexcept(true); 80*67e74705SXin Li 81*67e74705SXin Li virtual void f15() noexcept; 82*67e74705SXin Li virtual void f16() throw(); 83*67e74705SXin Li 84*67e74705SXin Li virtual void g1() throw(int); // expected-error {{exception specification of overriding function is more lax}} 85*67e74705SXin Li virtual void g2(); // expected-error {{exception specification of overriding function is more lax}} 86*67e74705SXin Li virtual void g3() throw(D); // expected-error {{exception specification of overriding function is more lax}} 87*67e74705SXin Li virtual void g4() throw(A); // expected-error {{exception specification of overriding function is more lax}} 88*67e74705SXin Li virtual void g5() throw(P); // expected-error {{exception specification of overriding function is more lax}} 89*67e74705SXin Li 90*67e74705SXin Li virtual void g6() noexcept(false); // expected-error {{exception specification of overriding function is more lax}} 91*67e74705SXin Li virtual void g7(); // expected-error {{exception specification of overriding function is more lax}} 92*67e74705SXin Li 93*67e74705SXin Li virtual void g8() throw(int); // expected-error {{exception specification of overriding function is more lax}} 94*67e74705SXin Li virtual void g9() noexcept(false); // expected-error {{exception specification of overriding function is more lax}} 95*67e74705SXin Li virtual void g10() noexcept(false); // expected-error {{exception specification of overriding function is more lax}} 96*67e74705SXin Li }; 97