1e434b34fSJonathan Roelofs //===---------------------- catch_function_02.cpp -------------------------===// 2e434b34fSJonathan Roelofs // 3e434b34fSJonathan Roelofs // The LLVM Compiler Infrastructure 4e434b34fSJonathan Roelofs // 5e434b34fSJonathan Roelofs // This file is dual licensed under the MIT and the University of Illinois Open 6e434b34fSJonathan Roelofs // Source Licenses. See LICENSE.TXT for details. 7e434b34fSJonathan Roelofs // 8e434b34fSJonathan Roelofs //===----------------------------------------------------------------------===// 9e434b34fSJonathan Roelofs 10e434b34fSJonathan Roelofs // Can you have a catch clause of array type that catches anything? 11*57e446daSAsiri Rathnayake // UNSUPPORTED: libcxxabi-no-exceptions 12e434b34fSJonathan Roelofs 13e434b34fSJonathan Roelofs #include <cassert> 14e434b34fSJonathan Roelofs 15e434b34fSJonathan Roelofs void f() {} 16e434b34fSJonathan Roelofs 17e434b34fSJonathan Roelofs int main() 18e434b34fSJonathan Roelofs { 19e434b34fSJonathan Roelofs typedef void Function(); 20e434b34fSJonathan Roelofs try 21e434b34fSJonathan Roelofs { 22e434b34fSJonathan Roelofs throw f; // converts to void (*)() 23e434b34fSJonathan Roelofs assert(false); 24e434b34fSJonathan Roelofs } 25e434b34fSJonathan Roelofs catch (Function b) // equivalent to void (*)() 26e434b34fSJonathan Roelofs { 27e434b34fSJonathan Roelofs } 28e434b34fSJonathan Roelofs catch (...) 29e434b34fSJonathan Roelofs { 30e434b34fSJonathan Roelofs assert(false); 31e434b34fSJonathan Roelofs } 32e434b34fSJonathan Roelofs } 33