brintos

brintos / llvm-project-archived public Read only

0
0
Text · 879 B · 6955f10 Raw
39 lines · cpp
1//===---------------------- catch_in_noexcept.cpp--------------------------===//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// UNSUPPORTED: c++0310// UNSUPPORTED: no-exceptions11 12#include <exception>13#include <stdlib.h>14#include <assert.h>15 16struct A {};17 18// Despite being marked as noexcept, this function must have an EHT entry that19// is not 'cantunwind', so that the unwinder can correctly deal with the throw.20void f1() noexcept21{22    try {23        A a;24        throw a;25        assert(false);26    } catch (...) {27        assert(true);28        return;29    }30    assert(false);31}32 33int main(int, char**)34{35    f1();36 37    return 0;38}39