brintos

brintos / llvm-project-archived public Read only

0
0
Text · 780 B · f92749a Raw
33 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// UNSUPPORTED: no-exceptions11 12#include <cassert>13 14int main(int, char**)15{16    typedef char Array[4];17    Array a = {'H', 'i', '!', 0};18    try19    {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    return 0;32}33