xref: /llvm-project/libcxxabi/test/catch_function_02.pass.cpp (revision eb8650a75793b2bd079d0c8901ff066f129061da)
1*eb8650a7SLouis Dionne //===----------------------------------------------------------------------===//
2e434b34fSJonathan Roelofs //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6e434b34fSJonathan Roelofs //
7e434b34fSJonathan Roelofs //===----------------------------------------------------------------------===//
8e434b34fSJonathan Roelofs 
9e434b34fSJonathan Roelofs // Can you have a catch clause of array type that catches anything?
108c61114cSLouis Dionne // UNSUPPORTED: no-exceptions
11e434b34fSJonathan Roelofs 
12e434b34fSJonathan Roelofs #include <cassert>
13e434b34fSJonathan Roelofs 
f()14e434b34fSJonathan Roelofs void f() {}
15e434b34fSJonathan Roelofs 
main(int,char **)16504bc07dSLouis Dionne int main(int, char**)
17e434b34fSJonathan Roelofs {
18e434b34fSJonathan Roelofs     typedef void Function();
19e434b34fSJonathan Roelofs     try
20e434b34fSJonathan Roelofs     {
21e434b34fSJonathan Roelofs         throw f;     // converts to void (*)()
22e434b34fSJonathan Roelofs         assert(false);
23e434b34fSJonathan Roelofs     }
24e434b34fSJonathan Roelofs     catch (Function b)  // equivalent to void (*)()
25e434b34fSJonathan Roelofs     {
26e434b34fSJonathan Roelofs     }
27e434b34fSJonathan Roelofs     catch (...)
28e434b34fSJonathan Roelofs     {
29e434b34fSJonathan Roelofs         assert(false);
30e434b34fSJonathan Roelofs     }
31504bc07dSLouis Dionne 
32504bc07dSLouis Dionne     return 0;
33e434b34fSJonathan Roelofs }
34