1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // Can you have a catch clause of array type that catches anything?
11 // GCC incorrectly allows function pointer to be caught by reference.
12 // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69372
14 // UNSUPPORTED: no-exceptions
16 // 65ace9daa360 made it in the dylib in macOS 10.11
17 // XFAIL: use_system_cxx_lib && target={{.+}}-apple-macosx10.{{9|10}}
22 bool can_convert(Tp
) { return true; }
25 bool can_convert(...) { return false; }
31 typedef void Function();
32 assert(!can_convert
<Function
&>(&f
));
33 assert(!can_convert
<void*>(&f
));
36 throw f
; // converts to void (*)()
39 catch (Function
& b
) // can't catch void (*)()
43 catch (void*) // can't catch as void*