brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · f4ebea7 Raw
30 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// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++2310 11// <functional>12 13// template<auto f> constexpr unspecified not_fn() noexcept;14// Mandates: If is_pointer_v<F> || is_member_pointer_v<F> is true, then f != nullptr is true.15 16#include <functional>17 18struct X {};19 20void test() {21  auto not_fn1 = std::not_fn<static_cast<bool (*)()>(nullptr)>();22  // expected-error@*:* {{static assertion failed due to requirement 'nullptr != nullptr': f cannot be equal to nullptr}}23 24  auto not_fn2 = std::not_fn<static_cast<bool X::*>(nullptr)>();25  // expected-error@*:* {{static assertion failed due to requirement 'nullptr != nullptr': f cannot be equal to nullptr}}26 27  auto not_fn3 = std::not_fn<static_cast<bool (X::*)()>(nullptr)>();28  // expected-error@*:* {{static assertion failed due to requirement 'nullptr != nullptr': f cannot be equal to nullptr}}29}30