const_block_error.cpp 493 B

1234567891011121314151617181920
  1. // Copyright (C) 2009-2012 Lorenzo Caminiti
  2. // Distributed under the Boost Software License, Version 1.0
  3. // (see accompanying file LICENSE_1_0.txt or a copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // Home at http://www.boost.org/libs/local_function
  6. #include "const_block.hpp"
  7. #include <cassert>
  8. int main(void) {
  9. //[const_block
  10. int x = 1, y = 2;
  11. CONST_BLOCK(x, y) { // Constant block.
  12. assert(x = y); // Compiler error.
  13. } CONST_BLOCK_END
  14. //]
  15. return 0;
  16. }