Howard Hinnant | 4b3cb1c | 2012-02-01 19:42:45 +0000 | [diff] [blame^] | 1 | //===---------------------- catch_function_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? |
| 11 | |
| 12 | #include <cassert> |
| 13 | |
| 14 | void f() {} |
| 15 | |
| 16 | int main() |
| 17 | { |
| 18 | typedef void Function(); |
| 19 | try |
| 20 | { |
| 21 | throw f; // converts to void (*)() |
| 22 | assert(false); |
| 23 | } |
| 24 | catch (Function b) // equivalent to void (*)() |
| 25 | { |
| 26 | } |
| 27 | catch (...) |
| 28 | { |
| 29 | assert(false); |
| 30 | } |
| 31 | } |