1e434b34fSJonathan Roelofs //===---------------------- catch_array_01.cpp ----------------------------===// 2e434b34fSJonathan Roelofs // 3e434b34fSJonathan Roelofs // The LLVM Compiler Infrastructure 4e434b34fSJonathan Roelofs // 5e434b34fSJonathan Roelofs // This file is dual licensed under the MIT and the University of Illinois Open 6e434b34fSJonathan Roelofs // Source Licenses. See LICENSE.TXT for details. 7e434b34fSJonathan Roelofs // 8e434b34fSJonathan Roelofs //===----------------------------------------------------------------------===// 9e434b34fSJonathan Roelofs 10e434b34fSJonathan Roelofs // Can you have a catch clause of array type that catches anything? 11e434b34fSJonathan Roelofs 123f7c2074SEric Fiselier // GCC incorrectly allows array types to be caught by reference. 133f7c2074SEric Fiselier // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69372 143f7c2074SEric Fiselier // XFAIL: gcc 15*57e446daSAsiri Rathnayake // UNSUPPORTED: libcxxabi-no-exceptions 163f7c2074SEric Fiselier 17e434b34fSJonathan Roelofs #include <cassert> 18e434b34fSJonathan Roelofs 19e434b34fSJonathan Roelofs int main() 20e434b34fSJonathan Roelofs { 21e434b34fSJonathan Roelofs typedef char Array[4]; 22e434b34fSJonathan Roelofs Array a = {'H', 'i', '!', 0}; 23e434b34fSJonathan Roelofs try 24e434b34fSJonathan Roelofs { 25e434b34fSJonathan Roelofs throw a; // converts to char* 26e434b34fSJonathan Roelofs assert(false); 27e434b34fSJonathan Roelofs } 28e434b34fSJonathan Roelofs catch (Array& b) // can't catch char* 29e434b34fSJonathan Roelofs { 30e434b34fSJonathan Roelofs assert(false); 31e434b34fSJonathan Roelofs } 32e434b34fSJonathan Roelofs catch (...) 33e434b34fSJonathan Roelofs { 34e434b34fSJonathan Roelofs } 35e434b34fSJonathan Roelofs } 36