aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/try-catch.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2008-12-22 19:15:10 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2008-12-22 19:15:10 +0000
commit4b07b2968f87f3cd5a3d8c76145f1cbfd718d42d (patch)
treec92a07839c5ff786350b17c99a1d7a68838a17fe /test/SemaCXX/try-catch.cpp
parent804058ece0d8f692faac8518ce4d98975ba57ac2 (diff)
Partial AST and Sema support for C++ try-catch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61337 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/try-catch.cpp')
-rw-r--r--test/SemaCXX/try-catch.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/SemaCXX/try-catch.cpp b/test/SemaCXX/try-catch.cpp
new file mode 100644
index 0000000000..920a1d59c7
--- /dev/null
+++ b/test/SemaCXX/try-catch.cpp
@@ -0,0 +1,19 @@
+// RUN: clang -fsyntax-only -verify %s
+
+struct A;
+
+void f()
+{
+ try {
+ } catch(int i) { // expected-note {{previous definition}}
+ int j = i;
+ int i; // expected-error {{redefinition of 'i'}}
+ } catch(float i) {
+ } catch(void v) { // expected-error {{cannot catch incomplete type 'void'}}
+ } catch(A a) { // expected-error {{cannot catch incomplete type 'struct A'}}
+ } catch(A *a) { // expected-error {{cannot catch pointer to incomplete type 'struct A'}}
+ } catch(A &a) { // expected-error {{cannot catch reference to incomplete type 'struct A'}}
+ } catch(...) {
+ int j = i; // expected-error {{use of undeclared identifier 'i'}}
+ }
+}