aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/exceptions.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2009-04-27 21:33:24 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2009-04-27 21:33:24 +0000
commit13e8854b186265a601545ca88f8f495fb3fb5654 (patch)
tree3d9a8da3c566698a8fbe732e21c82502e6241b3d /test/SemaCXX/exceptions.cpp
parent2bf1eb09f06a9792fa94dff0703f2aa2c4bace2a (diff)
Track down return statements in the handlers of a function-try-block of constructors. Meh ...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70256 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/exceptions.cpp')
-rw-r--r--test/SemaCXX/exceptions.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/SemaCXX/exceptions.cpp b/test/SemaCXX/exceptions.cpp
index 42973eba70..5882b9cb70 100644
--- a/test/SemaCXX/exceptions.cpp
+++ b/test/SemaCXX/exceptions.cpp
@@ -68,3 +68,32 @@ l5:
goto l2; // expected-error {{illegal goto into protected scope}}
goto l1;
}
+
+struct BadReturn {
+ BadReturn() try {
+ } catch(...) {
+ // Try to hide
+ try {
+ } catch(...) {
+ {
+ if (0)
+ return; // expected-error {{return in the catch of a function try block of a constructor is illegal}}
+ }
+ }
+ }
+ BadReturn(int);
+};
+
+BadReturn::BadReturn(int) try {
+} catch(...) {
+ // Try to hide
+ try {
+ } catch(int) {
+ return; // expected-error {{return in the catch of a function try block of a constructor is illegal}}
+ } catch(...) {
+ {
+ if (0)
+ return; // expected-error {{return in the catch of a function try block of a constructor is illegal}}
+ }
+ }
+}