1/*=============================================================================
2 Copyright (c) 2017 Paul Fultz II
3 implicit.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#include <boost/hof/implicit.hpp>
8
9template<class T>
10struct auto_caster
11{
12 template<class U>
13 T operator()(U x)
14 {
15 return T(x);
16 }
17};
18
19
20int main()
21{
22 boost::hof::implicit<auto_caster> auto_cast = {};
23 auto x = auto_cast(1.5);
24 (void)x;
25// This is not possible in c++17 due to guaranteed copy elison
26#if BOOST_HOF_HAS_STD_17 || (defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7)
27 static_assert(false, "Always fail");
28#endif
29}
30

source code of boost/libs/hof/test/fail/implicit.cpp