1*e434b34fSJonathan Roelofs //===---------------------- catch_array_01.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 int main()
15*e434b34fSJonathan Roelofs {
16*e434b34fSJonathan Roelofs     typedef char Array[4];
17*e434b34fSJonathan Roelofs     Array a = {'H', 'i', '!', 0};
18*e434b34fSJonathan Roelofs     try
19*e434b34fSJonathan Roelofs     {
20*e434b34fSJonathan Roelofs         throw a;  // converts to char*
21*e434b34fSJonathan Roelofs         assert(false);
22*e434b34fSJonathan Roelofs     }
23*e434b34fSJonathan Roelofs     catch (Array& b)  // can't catch char*
24*e434b34fSJonathan Roelofs     {
25*e434b34fSJonathan Roelofs         assert(false);
26*e434b34fSJonathan Roelofs     }
27*e434b34fSJonathan Roelofs     catch (...)
28*e434b34fSJonathan Roelofs     {
29*e434b34fSJonathan Roelofs     }
30*e434b34fSJonathan Roelofs }
31