prevent folly::Function<T const&()> from being initialized with a function that retur...
[folly.git] / folly / test / FunctionTest.cpp
index 34217a2c825d028e318ed940cdfb5cfd61920dc2..0d2dcd94e4e2905ed921635aff31555c0a55363e 100644 (file)
@@ -175,6 +175,25 @@ static_assert(
         Function<short(int) const>>::value,
     "");
 
+static_assert(
+    !std::is_constructible<Function<int const&()>, int (*)()>::value,
+    "");
+
+static_assert(
+    !std::is_constructible<Function<int const&() const>, int (*)()>::value,
+    "");
+
+#if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
+static_assert(
+    !std::is_constructible<Function<int const&() noexcept>, int (*)()>::value,
+    "");
+
+static_assert(
+    !std::is_constructible<Function<int const&() const noexcept>, int (*)()>::
+        value,
+    "");
+#endif
+
 // TEST =====================================================================
 // InvokeFunctor & InvokeReference