diff options
author | Howard Hinnant <hhinnant@apple.com> | 2012-02-01 19:21:28 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2012-02-01 19:21:28 +0000 |
commit | 26ffb64177f895e53b6c08d342e4e4608f87aee3 (patch) | |
tree | 122e630f2cc13d402d3e2626f8b2223c612ec33d /libcxxabi/test/catch_array_02.cpp | |
parent | af066bbb1f16a5286addcc6f5135029a271ed676 (diff) | |
download | bcm5719-llvm-26ffb64177f895e53b6c08d342e4e4608f87aee3.tar.gz bcm5719-llvm-26ffb64177f895e53b6c08d342e4e4608f87aee3.zip |
Quash TODO regarding catch by array type. Add tests to back it up.
llvm-svn: 149527
Diffstat (limited to 'libcxxabi/test/catch_array_02.cpp')
-rw-r--r-- | libcxxabi/test/catch_array_02.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libcxxabi/test/catch_array_02.cpp b/libcxxabi/test/catch_array_02.cpp new file mode 100644 index 00000000000..a06e6aaa056 --- /dev/null +++ b/libcxxabi/test/catch_array_02.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); + } +} |