summaryrefslogtreecommitdiffstats
path: root/libcxxabi/test/catch_array_02.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxxabi/test/catch_array_02.pass.cpp')
-rw-r--r--libcxxabi/test/catch_array_02.pass.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/libcxxabi/test/catch_array_02.pass.cpp b/libcxxabi/test/catch_array_02.pass.cpp
new file mode 100644
index 00000000000..a06e6aaa056
--- /dev/null
+++ b/libcxxabi/test/catch_array_02.pass.cpp
@@ -0,0 +1,30 @@
+//===---------------------- catch_array_02.cpp ----------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Can you have a catch clause of array type that catches anything?
+
+#include <cassert>
+
+int main()
+{
+ typedef char Array[4];
+ Array a = {'H', 'i', '!', 0};
+ try
+ {
+ throw a; // converts to char*
+ assert(false);
+ }
+ catch (Array b) // equivalent to char*
+ {
+ }
+ catch (...)
+ {
+ assert(false);
+ }
+}
OpenPOWER on IntegriCloud