• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===---------------------- catch_array_02.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 
main()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)  // equivalent to char*
24     {
25     }
26     catch (...)
27     {
28         assert(false);
29     }
30 }
31