Howard Hinnant | aafd08a | 2012-02-01 19:21:28 +0000 | [diff] [blame] | 1 | //===---------------------- catch_array_02.cpp ----------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // Can you have a catch clause of array type that catches anything? |
Asiri Rathnayake | 4174e8b | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 11 | // UNSUPPORTED: libcxxabi-no-exceptions |
Howard Hinnant | aafd08a | 2012-02-01 19:21:28 +0000 | [diff] [blame] | 12 | |
| 13 | #include <cassert> |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | typedef char Array[4]; |
| 18 | Array a = {'H', 'i', '!', 0}; |
| 19 | try |
| 20 | { |
| 21 | throw a; // converts to char* |
| 22 | assert(false); |
| 23 | } |
| 24 | catch (Array b) // equivalent to char* |
| 25 | { |
| 26 | } |
| 27 | catch (...) |
| 28 | { |
| 29 | assert(false); |
| 30 | } |
| 31 | } |