Add C++17 std::not_fn negator.

Summary:
Exactly what it sounds like.

I plan to commit this in a couple of days assuming no objections.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D20799

llvm-svn: 271464
diff --git a/libcxx/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp b/libcxx/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp
index 3f02c7c..e78323f 100644
--- a/libcxx/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp
@@ -304,8 +304,46 @@
     }
 }
 
+struct CopyThrows {
+  CopyThrows() {}
+  CopyThrows(CopyThrows const&) {}
+  CopyThrows(CopyThrows&&) noexcept {}
+};
+
+struct NoThrowCallable {
+  void operator()() noexcept {}
+  void operator()(CopyThrows) noexcept {}
+};
+
+struct ThrowsCallable {
+  void operator()() {}
+};
+
+struct MemberObj {
+  int x;
+};
+
+void noexcept_test() {
+    {
+        NoThrowCallable obj;
+        CopyThrows arg;
+        static_assert(noexcept(std::invoke(obj)));
+        static_assert(!noexcept(std::invoke(obj, arg)));
+        static_assert(noexcept(std::invoke(obj, std::move(arg))));
+    }
+    {
+        ThrowsCallable obj;
+        static_assert(!noexcept(std::invoke(obj)));
+    }
+    {
+        MemberObj obj{42};
+        static_assert(noexcept(std::invoke(&MemberObj::x, obj)));
+    }
+}
+
 int main() {
     bullet_one_two_tests();
     bullet_three_four_tests();
     bullet_five_tests();
+    noexcept_test();
 }