1e434b34fSJonathan Roelofs //===---------------------- catch_in_noexcept.cpp--------------------------===// 2e434b34fSJonathan Roelofs // 357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6e434b34fSJonathan Roelofs // 7e434b34fSJonathan Roelofs //===----------------------------------------------------------------------===// 8e434b34fSJonathan Roelofs 931cbe0f2SLouis Dionne // UNSUPPORTED: c++03 108c61114cSLouis Dionne // UNSUPPORTED: no-exceptions 11c79a8f77SEric Fiselier 12e434b34fSJonathan Roelofs #include <exception> 13e434b34fSJonathan Roelofs #include <stdlib.h> 14e434b34fSJonathan Roelofs #include <assert.h> 15e434b34fSJonathan Roelofs 16e434b34fSJonathan Roelofs struct A {}; 17e434b34fSJonathan Roelofs 18e434b34fSJonathan Roelofs // Despite being marked as noexcept, this function must have an EHT entry that 19e434b34fSJonathan Roelofs // is not 'cantunwind', so that the unwinder can correctly deal with the throw. f1()20e434b34fSJonathan Roelofsvoid f1() noexcept 21e434b34fSJonathan Roelofs { 22e434b34fSJonathan Roelofs try { 23e434b34fSJonathan Roelofs A a; 24e434b34fSJonathan Roelofs throw a; 25e434b34fSJonathan Roelofs assert(false); 26e434b34fSJonathan Roelofs } catch (...) { 27e434b34fSJonathan Roelofs assert(true); 28e434b34fSJonathan Roelofs return; 29e434b34fSJonathan Roelofs } 30e434b34fSJonathan Roelofs assert(false); 31e434b34fSJonathan Roelofs } 32e434b34fSJonathan Roelofs main(int,char **)33*504bc07dSLouis Dionneint main(int, char**) 34e434b34fSJonathan Roelofs { 35e434b34fSJonathan Roelofs f1(); 36*504bc07dSLouis Dionne 37*504bc07dSLouis Dionne return 0; 38e434b34fSJonathan Roelofs } 39