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