view libcxxabi/test/catch_function_02.pass.cpp @ 174:f935e5e0dbe7

merged
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 12:28:41 +0900
parents 0572611fdcc8
children 2e18cbf3894f
line wrap: on
line source

//===---------------------- catch_function_02.cpp -------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// Can you have a catch clause of array type that catches anything?
// UNSUPPORTED: no-exceptions

#include <cassert>

void f() {}

int main()
{
    typedef void Function();
    try
    {
        throw f;     // converts to void (*)()
        assert(false);
    }
    catch (Function b)  // equivalent to void (*)()
    {
    }
    catch (...)
    {
        assert(false);
    }
}