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