blob: 3bc9e4571d0c8dc07ae02297304e351d76b59790 [file] [log] [blame]
Brian Silvermane4580902018-08-04 23:36:31 -07001// Boost.Function library
2
3// Copyright Douglas Gregor 2001-2003. Use, modification and
4// distribution is subject to the Boost Software License, Version
5// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt)
7
8// For more information, see http://www.boost.org
9
10#include <boost/test/minimal.hpp>
11#include <boost/function.hpp>
12#include <stdexcept>
13
14struct stateless_integer_add {
15 int operator()(int x, int y) const { return x+y; }
16
17 void* operator new(std::size_t)
18 {
19 throw std::runtime_error("Cannot allocate a stateless_integer_add");
20 }
21
22 void* operator new(std::size_t, void* p)
23 {
24 return p;
25 }
26
27 void operator delete(void*) throw()
28 {
29 }
30};
31
32int test_main(int, char*[])
33{
34 boost::function2<int, int, int> f;
35 f = stateless_integer_add();
36
37 return 0;
38}