• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2017 Paul Fultz II
3     static_def2.cpp
4     Distributed under the Boost Software License, Version 1.0. (See accompanying
5     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 
8 #include <cstdio>
9 #include "static_def.hpp"
10 
11 extern void* f_sum_lambda_addr();
12 extern void* f_sum_fo_addr();
13 
14 extern void* sum_lambda_addr();
15 extern void* sum_fo_addr();
16 
17 extern void* f_sum_var_addr();
18 extern void* f_sum_constexpr_fo_addr();
19 
20 extern void* sum_var_addr();
21 extern void* sum_constexpr_fo_addr();
22 
f_sum_lambda_addr()23 void* f_sum_lambda_addr()
24 {
25     return (void*)&fit_test::fit_sum_lambda;
26 }
f_sum_fo_addr()27 void* f_sum_fo_addr()
28 {
29     return (void*)&fit_test::fit_sum_fo;
30 }
31 
f_sum_var_addr()32 void* f_sum_var_addr()
33 {
34     return (void*)&fit_test::fit_sum_var;
35 }
f_sum_constexpr_fo_addr()36 void* f_sum_constexpr_fo_addr()
37 {
38     return (void*)&fit_test::fit_sum_constexpr_fo;
39 }
40 
f()41 int f()
42 {
43     if (fit_test::fit_sum_fo(1, 2) != 3) printf("FAILED\n");
44     if (fit_test::fit_sum_lambda(1, 2) != 3) printf("FAILED\n");
45     if (fit_test::fit_sum(1, 2) != 3) printf("FAILED\n");
46 
47 #if BOOST_HOF_HAS_UNIQUE_STATIC_LAMBDA_FUNCTION_ADDR
48     if (sum_lambda_addr() != f_sum_lambda_addr()) printf("FAILED: Lambda\n");
49     if (sum_fo_addr() != f_sum_fo_addr()) printf("FAILED: Function object\n");
50 #endif
51 
52 #if BOOST_HOF_HAS_UNIQUE_STATIC_VAR
53     if (sum_var_addr() != f_sum_var_addr()) printf("FAILED: Lambda\n");
54     if (sum_constexpr_fo_addr() != f_sum_constexpr_fo_addr()) printf("FAILED: Function object\n");
55 #endif
56     return 0;
57 }
58 
59