brintos

brintos / llvm-project-archived public Read only

0
0
Text · 917 B · c636cc4 Raw
37 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// Can you have a catch clause of array type that catches anything?10 11// GCC incorrectly allows array types to be caught by reference.12// See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=6937213// XFAIL: gcc14// UNSUPPORTED: no-exceptions15 16#include <cassert>17 18int main(int, char**)19{20    typedef char Array[4];21    Array a = {'H', 'i', '!', 0};22    try23    {24        throw a;  // converts to char*25        assert(false);26    }27    catch (Array& b)  // can't catch char*28    {29        assert(false);30    }31    catch (...)32    {33    }34 35    return 0;36}37