boost_no_cxx11_ref_qualifiers.ipp 852 B

123456789101112131415161718192021222324252627282930313233
  1. // (C) Copyright Andrzej Krzemienski 2014
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/config for more information.
  6. // MACRO: BOOST_NO_CXX11_REF_QUALIFIERS
  7. // TITLE: C++11 ref-qualifiers on member functions.
  8. // DESCRIPTION: The compiler does not support the C++11 ref-qualifiers on member functions as described in N2439.
  9. namespace boost_no_cxx11_ref_qualifiers {
  10. struct G
  11. {
  12. char get() & { return 'l'; }
  13. char get() && { return 'r'; }
  14. char get() const& { return 'c'; }
  15. };
  16. int test()
  17. {
  18. G m;
  19. const G c = G();
  20. if (m.get() != 'l') return 1;
  21. if (c.get() != 'c') return 1;
  22. if (G().get() != 'r') return 1;
  23. return 0;
  24. }
  25. }