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