xref: /llvm-project/libcxxabi/test/catch_function_02.pass.cpp (revision eb8650a75793b2bd079d0c8901ff066f129061da)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // Can you have a catch clause of array type that catches anything?
10 // UNSUPPORTED: no-exceptions
11 
12 #include <cassert>
13 
f()14 void f() {}
15 
main(int,char **)16 int main(int, char**)
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 
32     return 0;
33 }
34