ignore_unused_test.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
  2. //
  3. // Use, modification and distribution is subject to the Boost Software License,
  4. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #include <boost/core/ignore_unused.hpp>
  7. BOOST_CXX14_CONSTEXPR int test_fun(int a)
  8. {
  9. boost::ignore_unused(a);
  10. return 0;
  11. }
  12. int main()
  13. {
  14. {
  15. int a;
  16. boost::ignore_unused(a);
  17. }
  18. {
  19. int a, b;
  20. boost::ignore_unused(a, b);
  21. }
  22. {
  23. int a, b, c;
  24. boost::ignore_unused(a, b, c);
  25. }
  26. {
  27. int a, b, c, d;
  28. boost::ignore_unused(a, b, c, d);
  29. }
  30. {
  31. int a, b, c, d, e;
  32. boost::ignore_unused(a, b, c, d, e);
  33. }
  34. {
  35. typedef int a;
  36. boost::ignore_unused<a>();
  37. }
  38. {
  39. typedef int a;
  40. typedef int b;
  41. boost::ignore_unused<a, b>();
  42. }
  43. {
  44. typedef int a;
  45. typedef int b;
  46. typedef int c;
  47. boost::ignore_unused<a, b, c>();
  48. }
  49. {
  50. typedef int a;
  51. typedef int b;
  52. typedef int c;
  53. typedef int d;
  54. boost::ignore_unused<a, b, c, d>();
  55. }
  56. {
  57. typedef int a;
  58. typedef int b;
  59. typedef int c;
  60. typedef int d;
  61. typedef int e;
  62. boost::ignore_unused<a, b, c, d, e>();
  63. }
  64. {
  65. BOOST_CXX14_CONSTEXPR const int a = test_fun(0);
  66. boost::ignore_unused(a);
  67. }
  68. return 0;
  69. }