1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <memory>
11
12// template <class Alloc>
13// struct allocator_traits
14// {
15//     static void deallocate(allocator_type& a, pointer p, size_type n);
16//     ...
17// };
18
19#include <memory>
20#include <cassert>
21
22int called = 0;
23
24template <class T>
25struct A
26{
27    typedef T value_type;
28
29    void deallocate(value_type* p, std::size_t n)
30    {
31        assert(p == (value_type*)0xDEADBEEF);
32        assert(n == 10);
33        ++called;
34    }
35};
36
37int main()
38{
39    A<int> a;
40    std::allocator_traits<A<int> >::deallocate(a, (int*)0xDEADBEEF, 10);
41    assert(called == 1);
42}
43