1e434b34fSJonathan Roelofs //===---------------------- catch_array_01.cpp ----------------------------===//
2e434b34fSJonathan Roelofs //
3*57b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*57b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
5*57b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6e434b34fSJonathan Roelofs //
7e434b34fSJonathan Roelofs //===----------------------------------------------------------------------===//
8e434b34fSJonathan Roelofs 
9e434b34fSJonathan Roelofs // Can you have a catch clause of array type that catches anything?
10e434b34fSJonathan Roelofs 
113f7c2074SEric Fiselier // GCC incorrectly allows array types to be caught by reference.
123f7c2074SEric Fiselier // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69372
133f7c2074SEric Fiselier // XFAIL: gcc
1457e446daSAsiri Rathnayake // UNSUPPORTED: libcxxabi-no-exceptions
153f7c2074SEric Fiselier 
16e434b34fSJonathan Roelofs #include <cassert>
17e434b34fSJonathan Roelofs 
18e434b34fSJonathan Roelofs int main()
19e434b34fSJonathan Roelofs {
20e434b34fSJonathan Roelofs     typedef char Array[4];
21e434b34fSJonathan Roelofs     Array a = {'H', 'i', '!', 0};
22e434b34fSJonathan Roelofs     try
23e434b34fSJonathan Roelofs     {
24e434b34fSJonathan Roelofs         throw a;  // converts to char*
25e434b34fSJonathan Roelofs         assert(false);
26e434b34fSJonathan Roelofs     }
27e434b34fSJonathan Roelofs     catch (Array& b)  // can't catch char*
28e434b34fSJonathan Roelofs     {
29e434b34fSJonathan Roelofs         assert(false);
30e434b34fSJonathan Roelofs     }
31e434b34fSJonathan Roelofs     catch (...)
32e434b34fSJonathan Roelofs     {
33e434b34fSJonathan Roelofs     }
34e434b34fSJonathan Roelofs }
35