]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/dll/test/cpp_test_library.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / dll / test / cpp_test_library.cpp
CommitLineData
7c673cae
FG
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
92f5a8d4 13#include <boost/dll/config.hpp>
7c673cae
FG
14#include <boost/variant.hpp>
15
16BOOST_SYMBOL_EXPORT extern int unscoped_var;
17int unscoped_var = 42;
18
19BOOST_SYMBOL_EXPORT extern const double unscoped_c_var;
20const double unscoped_c_var = 1.234;
21
22
23namespace some_space {
24
25BOOST_SYMBOL_EXPORT extern double variable;
26double variable = 0.2;
27BOOST_SYMBOL_EXPORT const int & scoped_fun()
28{
29 static int x = 0xDEADBEEF;
30 return x;
31}
32
33}
34
35
36BOOST_SYMBOL_EXPORT void overloaded(const volatile int i)
37{
38 unscoped_var = i;
39}
40
41BOOST_SYMBOL_EXPORT void overloaded(const double d)
42{
43 some_space::variable = d;
44}
45
46BOOST_SYMBOL_EXPORT void use_variant(boost::variant<int, double> & v)
47{
48 v = 42;
49}
50
51BOOST_SYMBOL_EXPORT void use_variant(boost::variant<double, int> & v)
52{
53 v = 3.124;
54}
55
56
57
58namespace some_space
59{
60
61BOOST_SYMBOL_EXPORT extern int father_value;
62int father_value = 12;
63
64struct BOOST_SYMBOL_EXPORT some_father
65{
66 some_father() { father_value = 24; };
67 ~some_father() { father_value = 112; };
68};
69
70
71
72struct 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
98some_class::some_class(some_class &&){}
99
100
101some_class& some_class::operator=(some_class &&ref) {return ref;}
102
103
104BOOST_SYMBOL_EXPORT extern std::size_t size_of_some_class;
105std::size_t size_of_some_class = sizeof(some_space::some_class);
106
107
108extern "C" BOOST_SYMBOL_EXPORT const volatile some_class* this_;
109const volatile some_class * this_ = nullptr;
110
111int some_class::value = -1;
112
113void 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
118double some_class::func(double i, double j) {this_ = this; return i*j;}
119int some_class::func(int i, int j) {this_ = this; return i+j;}
120int some_class::func(int i, int j) volatile {this_ = this; return i-j;;}
121double some_class::func(double i, double j) const volatile {this_ = this; return i/j;}
122
123int some_class::get() const {this_ = this; return mem_val;}
124void some_class::set(int i) {this_ = this; mem_val = i;}
125
126some_class::some_class() { this_ = this; value = 23; mem_val = 123;}
127some_class::some_class(int i) : mem_val(456) {this_ = this; value = i;}
128
129some_class::~some_class()
130{
131 value = 0;
132 this_ = this;
133}
134
135}
136
137
138#endif