This commit is contained in:
Mike Crowe 2018-01-13 15:02:35 +00:00 committed by GitHub
commit 42b245f714

View File

@ -508,6 +508,18 @@ class value {
template <typename T>
value(T *p) { set_pointer(p); }
// Match function pointers explicitly. If we do not then the
// forwarding T * constructor below will end up trying to call
// itself when a function pointer is passed, which leads to a
// confusing error message.
template <typename T, typename ...Args>
value(T (*p)(Args...)) {
// This static_assert must use something that is dependent on T,
// otherwise it will always fire, so let's use the same check as
// above - it will never match.
static_assert(std::is_same<T, void>::value, "formatting of function pointers is disallowed");
}
template <typename T>
value(const T *p) { set_pointer(p); }