initialized_test_fail1.cpp 843 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2010, Niels Dekker.
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See
  4. // accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Test program for boost::initialized<T>. Must fail to compile.
  8. //
  9. // Initial: 2 May 2010
  10. #include <boost/utility/value_init.hpp>
  11. namespace
  12. {
  13. void direct_initialize_from_int()
  14. {
  15. // Okay: initialized<T> supports direct-initialization from T.
  16. boost::initialized<int> direct_initialized_int(1);
  17. }
  18. void copy_initialize_from_int()
  19. {
  20. // The following line should not compile, because initialized<T>
  21. // was not intended to supports copy-initialization from T.
  22. boost::initialized<int> copy_initialized_int = 1;
  23. }
  24. }
  25. int main()
  26. {
  27. // This should fail to compile, so there is no need to call any function.
  28. return 0;
  29. }