diff options
author | loewis <loewis@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-02-22 16:15:42 +0000 |
---|---|---|
committer | loewis <loewis@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-02-22 16:15:42 +0000 |
commit | 22e2b0d04b4f635c1091942c78f8b6c7079b1db9 (patch) | |
tree | e4814567a1d0c54e9ca7badff1dd37d243f61a08 | |
parent | e91c8aa9c2ee11182b4ba12bd74b961fddc261df (diff) | |
download | gcc-22e2b0d04b4f635c1091942c78f8b6c7079b1db9.tar.gz |
New test case from Nathan Sidwell.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25379 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.eh/spec6.C | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec6.C b/gcc/testsuite/g++.old-deja/g++.eh/spec6.C new file mode 100644 index 00000000000..dd0a4d7b8a9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec6.C @@ -0,0 +1,46 @@ +// Build don't link: + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 19 Jan 1999 <nathan@acm.org> + +// Determine that throw specifiers are checked correctly. + +// [except.spec] 1, a type in an exception specifier shall not be incomplete, +// or pointer or ref to incomplete +struct X; // ERROR - forward declaration +void fn1() throw(X); // ERROR - incomplete type +void fn2() throw(X *); // ERROR - incomplete type +void fn3() throw(X &); // ERROR - incomplete type +void fn4() throw(void); // ERROR - incomplete type +// except for cv pointer to void +void fn5() throw(void *); + +// [except.spec] 2, exception specifiers must be the same set of types (but +// can be reordered) +void fn() throw(int, char); +void fn() throw(char, int){} + +// [except.spec] 3, virtual function overriders shall throw a subset of the +// overridden function +struct E {}; +struct F : public E {}; +struct A +{ + virtual void foo() throw(); + virtual void baz() throw(double, int); + virtual void bar(); + virtual void qux() throw(E); + virtual void quux() throw(F); +}; + +struct B : A +{ + virtual void foo() throw(int); // ERROR - not in base function + virtual void baz() throw(double); + virtual void bar(int) throw(int); + virtual void qux() throw(F); + virtual void quux() throw(E); // ERROR - not in base function +}; + +// [except.spec] 5, types shall not be defined in exception specifiers +void fn6() throw(struct Z {}); // ERROR - types shall not be defined |