brintos

brintos / llvm-project-archived public Read only

0
0
Text · 911 B · af4d2ee Raw
43 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// <memory>10 11// default_delete12 13// Test that default_delete<T[]> has a working default constructor14 15#include <memory>16#include <cassert>17 18#include "test_macros.h"19#include "unique_ptr_test_helper.h"20 21TEST_CONSTEXPR_CXX23 bool test() {22  std::default_delete<A[]> d;23  A* p = new A[3];24  if (!TEST_IS_CONSTANT_EVALUATED)25    assert(A::count == 3);26 27  d(p);28 29  if (!TEST_IS_CONSTANT_EVALUATED)30    assert(A::count == 0);31 32  return true;33}34 35int main(int, char**) {36  test();37#if TEST_STD_VER >= 2338  static_assert(test());39#endif40 41  return 0;42}43