libcxx

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

PR23141_invoke_not_constexpr.pass.cpp (933B)


      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 // UNSUPPORTED: c++98, c++03
     11 
     12 // <functional>
     13 
     14 // template<CopyConstructible Fn, CopyConstructible... Types>
     15 //   unspecified bind(Fn, Types...);
     16 // template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
     17 //   unspecified bind(Fn, Types...);
     18 
     19 // https://bugs.llvm.org/show_bug.cgi?id=23141
     20 #include <functional>
     21 #include <type_traits>
     22 
     23 struct Fun
     24 {
     25   template<typename T, typename U>
     26   void operator()(T &&, U &&) const
     27   {
     28     static_assert(std::is_same<U, int &>::value, "");
     29   }
     30 };
     31 
     32 int main()
     33 {
     34     std::bind(Fun{}, std::placeholders::_1, 42)("hello");
     35 }