1 /*==============================================================================
2     Copyright (c) 2006 Peter Dimov
3     Copyright (c) 2014 Agustin Berge
4     Copyright (c) 2015 John Fletcher
5 
6     Distributed under the Boost Software License, Version 1.0. (See accompanying
7     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 ==============================================================================*/
9 
10 #include <boost/config.hpp>
11 
12 #if defined(BOOST_MSVC)
13 #pragma warning(disable: 4786)  // identifier truncated in debug info
14 #pragma warning(disable: 4710)  // function not inlined
15 #pragma warning(disable: 4711)  // function selected for automatic inline expansion
16 #pragma warning(disable: 4514)  // unreferenced inline removed
17 #endif
18 
19 #include <boost/phoenix/core.hpp>
20 #include <boost/phoenix/bind.hpp>
21 #include <boost/ref.hpp>
22 
23 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
24 #pragma warning(push, 3)
25 #endif
26 
27 #include <iostream>
28 
29 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
30 #pragma warning(pop)
31 #endif
32 
33 #include <boost/detail/lightweight_test.hpp>
34 
35 //
36 
37 struct Z
38 {
39     int m;
40 };
41 
member_data_test()42 void member_data_test()
43 {
44     using boost::phoenix::bind;
45 
46     Z z = { 17041 };
47     Z * pz = &z;
48 
49     bind<void>( &Z::m, _1 )( z );
50     bind<void>( &Z::m, _1 )( pz );
51 
52     bind<void>( &Z::m, z )();
53     bind<void>( &Z::m, pz )();
54     bind<void>( &Z::m, boost::ref(z) )();
55 
56 
57     Z const cz = z;
58     Z const * pcz = &cz;
59 
60     bind<void>( &Z::m, _1 )( cz );
61     bind<void>( &Z::m, _1 )( pcz );
62 
63     bind<void>( &Z::m, cz )();
64     bind<void>( &Z::m, pcz )();
65     bind<void>( &Z::m, boost::ref(cz) )();
66 }
67 
main()68 int main()
69 {
70     member_data_test();
71 
72     return boost::report_errors();
73 }
74