blob: a927e8f9a6b3e99cb42df759c67b9b59846fb9ac [file] [log] [blame]
Howard Hinnantaafd08a2012-02-01 19:21:28 +00001//===---------------------- 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
Eric Fiseliere65dd842016-01-20 04:06:46 +000012// GCC incorrectly allows array types to be caught by reference.
13// See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69372
14// XFAIL: gcc
Asiri Rathnayake4174e8b2016-05-31 12:01:32 +000015// UNSUPPORTED: libcxxabi-no-exceptions
Eric Fiseliere65dd842016-01-20 04:06:46 +000016
Howard Hinnantaafd08a2012-02-01 19:21:28 +000017#include <cassert>
18
19int main()
20{
21 typedef char Array[4];
22 Array a = {'H', 'i', '!', 0};
23 try
24 {
25 throw a; // converts to char*
26 assert(false);
27 }
28 catch (Array& b) // can't catch char*
29 {
30 assert(false);
31 }
32 catch (...)
33 {
34 }
35}