summaryrefslogtreecommitdiffstats
path: root/libcxx/test/language.support/support.exception/uncaught/uncaught_exception.pass.cpp
blob: 3d6f53c462293f20a9e3684f42808ced0cdbb983 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// test uncaught_exception

#include <exception>
#include <cassert>

struct A
{
    ~A()
    {
        assert(std::uncaught_exception());
    }
};

int main()
{
    try
    {
        A a;
        assert(!std::uncaught_exception());
        throw 1;
    }
    catch (...)
    {
        assert(!std::uncaught_exception());
    }
    assert(!std::uncaught_exception());
}
OpenPOWER on IntegriCloud