• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 
11 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_NODISCARD_EXT
12 
13 // Check that <bit> functions aren't marked [[nodiscard]] when
14 // _LIBCPP_DISABLE_NODISCARD_EXT is defined
15 
16 #include <bit>
17 
18 #include "test_macros.h"
19 
func()20 void func() {
21   std::bit_cast<unsigned int>(42);
22   std::bit_ceil(0u);
23   std::bit_floor(0u);
24   std::bit_width(0u);
25 #if TEST_STD_VER >= 23
26   std::byteswap(0u);
27 #endif
28   std::countl_zero(0u);
29   std::countl_one(0u);
30   std::countr_zero(0u);
31   std::countr_one(0u);
32   std::has_single_bit(0u);
33   std::popcount(0u);
34 }
35