From 8fe0a63e56fa5e9999d6cb793a0b8ddb31241c73 Mon Sep 17 00:00:00 2001 From: Hans Fugal Date: Thu, 2 Jul 2015 11:43:42 -0700 Subject: [PATCH] nice error message if you try to Future Summary: If you try to make a future or promise of `void`, you will get this nice error message telling you to use `Unit` instead. Reviewed By: @djwatson Differential Revision: D2211239 --- folly/futures/detail/Core.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/folly/futures/detail/Core.h b/folly/futures/detail/Core.h index f0018862..a01285fa 100644 --- a/folly/futures/detail/Core.h +++ b/folly/futures/detail/Core.h @@ -74,6 +74,8 @@ enum class State : uint8_t { /// time there won't be any problems. template class Core { + static_assert(!std::is_void::value, + "void futures are not supported. Use Unit instead."); public: /// This must be heap-constructed. There's probably a way to enforce that in /// code but since this is just internal detail code and I don't know how -- 2.34.1