41 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <vector>10 11#include <cassert>12#include <vector>13 14#include "test_macros.h"15 16TEST_CONSTEXPR_CXX20 bool test() {17 using CRefT = std::vector<bool>::const_reference;18#if !defined(_LIBCPP_VERSION) || defined(_LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL)19 ASSERT_SAME_TYPE(CRefT, bool);20#else21 ASSERT_SAME_TYPE(CRefT, std::__bit_const_reference<std::vector<bool> >);22 std::vector<bool> vec;23 vec.push_back(true);24 CRefT ref = vec[0];25 assert(ref);26 vec[0] = false;27 assert(!ref);28#endif29 30 return true;31}32 33int main(int, char**) {34 test();35#if TEST_STD_VER > 1736 static_assert(test());37#endif38 39 return 0;40}41