libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

ptr_fun1.cxx1z.fail.cpp (740B)


      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <functional>
     11 
     12 // template <CopyConstructible Arg, Returnable Result>
     13 // pointer_to_unary_function<Arg, Result>
     14 // ptr_fun(Result (*f)(Arg));
     15 // UNSUPPORTED: c++98, c++03, c++11, c++14
     16 
     17 #include <functional>
     18 #include <type_traits>
     19 #include <cassert>
     20 
     21 #include "test_macros.h"
     22 
     23 double unary_f(int i) {return 0.5 - i;}
     24 
     25 int main()
     26 {
     27     assert(std::ptr_fun(unary_f)(36) == -35.5);
     28 }