brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · f1c5b07 Raw
44 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++0310 11// <functional>12 13// template<CopyConstructible Fn, CopyConstructible... Types>14//   unspecified bind(Fn, Types...);    // constexpr since C++2015// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>16//   unspecified bind(Fn, Types...);    // constexpr since C++2017 18// https://llvm.org/PR2314119#include <functional>20#include <type_traits>21 22#include "test_macros.h"23 24struct Fun {25  template<typename T, typename U>26  TEST_CONSTEXPR_CXX20 void operator()(T &&, U &&) const {27    static_assert(std::is_same<U, int &>::value, "");28  }29};30 31TEST_CONSTEXPR_CXX20 bool test() {32  std::bind(Fun{}, std::placeholders::_1, 42)("hello");33  return true;34}35 36int main(int, char**) {37  test();38#if TEST_STD_VER >= 2039  static_assert(test());40#endif41 42  return 0;43}44