summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/memory/util.dynamic.safety/declare_reachable.pass.cpp
blob: 3f0bcead9bef1ca9e94dcb0f210c18620d10d917 (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
//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// void declare_reachable(void* p);
// template <class T> T* undeclare_reachable(T* p);

#include <memory>
#include <cassert>

int main()
{
    int* p = new int;
    std::declare_reachable(p);
    assert(std::undeclare_reachable(p) == p);
    delete p;
}
OpenPOWER on IntegriCloud