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// REQUIRES: has-unix-headers
10// UNSUPPORTED: c++03
11// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
12// XFAIL: availability-verbose_abort-missing
13
14// <algorithm>
15
16// Calling `pop_heap` on an empty range is invalid.
17
18#include <algorithm>
19
20#include <array>
21#include "check_assertion.h"
22
23int main(int, char**) {
24 std::array<int, 0> a;
25
26 TEST_LIBCPP_ASSERT_FAILURE(std::pop_heap(a.begin(), a.end()), "The heap given to pop_heap must be non-empty");
27
28 return 0;
29}
30

source code of libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/assert.pop_heap.pass.cpp