1 //
2 // Test for core::is_same<T1,T2>
3 //
4 // Copyright 2014 Peter Dimov
5 //
6 // Distributed under the Boost Software License, Version 1.0.
7 // See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt
9 //
10
11 #include <boost/core/is_same.hpp>
12 #include <boost/core/lightweight_test_trait.hpp>
13
14 struct X
15 {
16 };
17
18 struct Y
19 {
20 };
21
main()22 int main()
23 {
24 BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<X, X> ));
25 BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<Y, Y> ));
26 BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<void, void> ));
27 BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<int, int> ));
28 BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<void const volatile, void const volatile> ));
29
30 BOOST_TEST_TRAIT_FALSE(( boost::core::is_same<X, Y> ));
31 BOOST_TEST_TRAIT_FALSE(( boost::core::is_same<X, X const> ));
32 BOOST_TEST_TRAIT_FALSE(( boost::core::is_same<X, void> ));
33 BOOST_TEST_TRAIT_FALSE(( boost::core::is_same<X, int> ));
34 BOOST_TEST_TRAIT_FALSE(( boost::core::is_same<int, void> ));
35 BOOST_TEST_TRAIT_FALSE(( boost::core::is_same<void, void const volatile> ));
36
37 return boost::report_errors();
38 }
39