]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/dll/test/cpp_test_library.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / dll / test / cpp_test_library.cpp
1 // Copyright 2016 Klemens Morgenstern
2 //
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt
5 // or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7 // For more information, see http://www.boost.org
8
9 #include <boost/predef.h>
10
11 #if (__cplusplus >= 201402L) || (BOOST_COMP_MSVC >= BOOST_VERSION_NUMBER(14,0,0))
12
13 #include <boost/config.hpp>
14 #include <boost/variant.hpp>
15
16 BOOST_SYMBOL_EXPORT extern int unscoped_var;
17 int unscoped_var = 42;
18
19 BOOST_SYMBOL_EXPORT extern const double unscoped_c_var;
20 const double unscoped_c_var = 1.234;
21
22
23 namespace some_space {
24
25 BOOST_SYMBOL_EXPORT extern double variable;
26 double variable = 0.2;
27 BOOST_SYMBOL_EXPORT const int & scoped_fun()
28 {
29 static int x = 0xDEADBEEF;
30 return x;
31 }
32
33 }
34
35
36 BOOST_SYMBOL_EXPORT void overloaded(const volatile int i)
37 {
38 unscoped_var = i;
39 }
40
41 BOOST_SYMBOL_EXPORT void overloaded(const double d)
42 {
43 some_space::variable = d;
44 }
45
46 BOOST_SYMBOL_EXPORT void use_variant(boost::variant<int, double> & v)
47 {
48 v = 42;
49 }
50
51 BOOST_SYMBOL_EXPORT void use_variant(boost::variant<double, int> & v)
52 {
53 v = 3.124;
54 }
55
56
57
58 namespace some_space
59 {
60
61 BOOST_SYMBOL_EXPORT extern int father_value;
62 int father_value = 12;
63
64 struct BOOST_SYMBOL_EXPORT some_father
65 {
66 some_father() { father_value = 24; };
67 ~some_father() { father_value = 112; };
68 };
69
70
71
72 struct BOOST_SYMBOL_EXPORT some_class : some_father
73 {
74 static int value ;
75 static void set_value(const int &i);
76
77 // static some_class* dummy();
78
79 virtual double func(double i, double j);
80 virtual int func(int i, int j);
81 int func(int i, int j) volatile;
82 double func(double i, double j) const volatile;
83
84 int mem_val;
85 int get() const ;
86 void set(int i) ;
87
88 some_class();
89 some_class(some_class &&);
90 some_class(int i);
91
92 some_class& operator=(some_class &&);
93
94
95 virtual ~some_class();
96 };
97
98 some_class::some_class(some_class &&){}
99
100
101 some_class& some_class::operator=(some_class &&ref) {return ref;}
102
103
104 BOOST_SYMBOL_EXPORT extern std::size_t size_of_some_class;
105 std::size_t size_of_some_class = sizeof(some_space::some_class);
106
107
108 extern "C" BOOST_SYMBOL_EXPORT const volatile some_class* this_;
109 const volatile some_class * this_ = nullptr;
110
111 int some_class::value = -1;
112
113 void some_class::set_value(const int &i) {value = i;}
114
115
116 //some_class* some_class::dummy() {return new some_class();}//so it implements an allocating ctor.
117
118 double some_class::func(double i, double j) {this_ = this; return i*j;}
119 int some_class::func(int i, int j) {this_ = this; return i+j;}
120 int some_class::func(int i, int j) volatile {this_ = this; return i-j;;}
121 double some_class::func(double i, double j) const volatile {this_ = this; return i/j;}
122
123 int some_class::get() const {this_ = this; return mem_val;}
124 void some_class::set(int i) {this_ = this; mem_val = i;}
125
126 some_class::some_class() { this_ = this; value = 23; mem_val = 123;}
127 some_class::some_class(int i) : mem_val(456) {this_ = this; value = i;}
128
129 some_class::~some_class()
130 {
131 value = 0;
132 this_ = this;
133 }
134
135 }
136
137
138 #endif