diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-07-07 20:29:57 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-07-07 20:29:57 +0000 |
commit | 86be854fa869f4c292e6b261d0ce1bf5d27b495e (patch) | |
tree | 0a2c6fbfaefe91cb44e117ea602a73e393484b21 /clang/test/SemaCXX/exception-spec.cpp | |
parent | e9f98047623959176f351d2001f2e8c10eb8b728 (diff) | |
download | bcm5719-llvm-86be854fa869f4c292e6b261d0ce1bf5d27b495e.tar.gz bcm5719-llvm-86be854fa869f4c292e6b261d0ce1bf5d27b495e.zip |
Implement checking of exception spec compatibility for overriding virtual functions.
llvm-svn: 74943
Diffstat (limited to 'clang/test/SemaCXX/exception-spec.cpp')
-rw-r--r-- | clang/test/SemaCXX/exception-spec.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/exception-spec.cpp b/clang/test/SemaCXX/exception-spec.cpp index 5eba26e70c6..dd12f3032fb 100644 --- a/clang/test/SemaCXX/exception-spec.cpp +++ b/clang/test/SemaCXX/exception-spec.cpp @@ -61,3 +61,54 @@ void r7() throw(float); // expected-error {{exception specification in declarati // Top-level const doesn't matter. void r8() throw(int); void r8() throw(const int); + +struct A +{ +}; + +struct B1 : A +{ +}; + +struct B2 : A +{ +}; + +struct D : B1, B2 +{ +}; + +struct Base +{ + virtual void f1() throw(); + virtual void f2(); + virtual void f3() throw(...); + virtual void f4() throw(int, float); + + virtual void f5() throw(int, float); + virtual void f6() throw(A); + virtual void f7() throw(A, int, float); + virtual void f8(); + + virtual void g1() throw(); // expected-note {{overridden virtual function is here}} + virtual void g2() throw(int); // expected-note {{overridden virtual function is here}} + virtual void g3() throw(A); // expected-note {{overridden virtual function is here}} + virtual void g4() throw(B1); // expected-note {{overridden virtual function is here}} +}; +struct Derived : Base +{ + virtual void f1() throw(); + virtual void f2() throw(...); + virtual void f3(); + virtual void f4() throw(float, int); + + virtual void f5() throw(float); + virtual void f6() throw(B1); + virtual void f7() throw(B1, B2, int); + virtual void f8() throw(B2, B2, int, float, char, double, bool); + + virtual void g1() throw(int); // expected-error {{exception specification of overriding function is more lax}} + virtual void g2(); // expected-error {{exception specification of overriding function is more lax}} + virtual void g3() throw(D); // expected-error {{exception specification of overriding function is more lax}} + virtual void g4() throw(A); // expected-error {{exception specification of overriding function is more lax}} +}; |