1 // Copyright (C) 2014, Andrzej Krzemienski. 2 // 3 // Use, modification, and distribution is subject to the Boost Software 4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 // http://www.boost.org/LICENSE_1_0.txt) 6 // 7 // See http://www.boost.org/lib/optional for documentation. 8 // 9 // You are welcome to contact the author at: 10 // akrzemi1@gmail.com 11 // 12 #include "boost/optional.hpp" 13 14 // 15 // THIS TEST SHOULD FAIL TO COMPILE 16 // 17 18 struct U 19 {}; 20 21 struct T 22 { TT23 explicit T(U const&) {} 24 }; 25 26 test_implicit_conversion_to_bool()27void test_implicit_conversion_to_bool() 28 { 29 boost::optional<T> opt; 30 opt.value_or(U()); 31 } 32 33