Summary: It was changed to a `void*` previously due to an ICE in GCC 4.7. GCC 4.7 hasn't been supported in quite a while, and newer versions of GCC don't crash, so it's time to switch it back to `nullptr_t`.
Reviewed By: yfeldblum
Differential Revision:
D4917389
fbshipit-source-id:
fc48642026c7e3aaeadef27bb949f70648c2312c
do { \
switch ((type)) { \
case NULLT: \
do { \
switch ((type)) { \
case NULLT: \
+ apply(std::nullptr_t); \
break; \
case ARRAY: \
apply(Array); \
break; \
case ARRAY: \
apply(Array); \
return get_nothrow<int64_t>() != nullptr;
}
inline bool dynamic::isNull() const {
return get_nothrow<int64_t>() != nullptr;
}
inline bool dynamic::isNull() const {
- return get_nothrow<void*>() != nullptr;
+ return get_nothrow<std::nullptr_t>() != nullptr;
}
inline bool dynamic::isNumber() const {
return isInt() || isDouble();
}
inline bool dynamic::isNumber() const {
return isInt() || isDouble();
+template<>
+struct dynamic::CompareOp<std::nullptr_t> {
+ static bool comp(std::nullptr_t const&, std::nullptr_t const&) {
+ return true;
+ }
+};
inline dynamic& dynamic::operator+=(dynamic const& o) {
if (type() == STRING && o.type() == STRING) {
inline dynamic& dynamic::operator+=(dynamic const& o) {
if (type() == STRING && o.type() == STRING) {
-FOLLY_DYNAMIC_DEC_TYPEINFO(void*, "null", dynamic::NULLT)
+FOLLY_DYNAMIC_DEC_TYPEINFO(std::nullptr_t, "null", dynamic::NULLT)
FOLLY_DYNAMIC_DEC_TYPEINFO(bool, "boolean", dynamic::BOOL)
FOLLY_DYNAMIC_DEC_TYPEINFO(std::string, "string", dynamic::STRING)
FOLLY_DYNAMIC_DEC_TYPEINFO(dynamic::Array, "array", dynamic::ARRAY)
FOLLY_DYNAMIC_DEC_TYPEINFO(bool, "boolean", dynamic::BOOL)
FOLLY_DYNAMIC_DEC_TYPEINFO(std::string, "string", dynamic::STRING)
FOLLY_DYNAMIC_DEC_TYPEINFO(dynamic::Array, "array", dynamic::ARRAY)
}
template<class T> struct dynamic::GetAddrImpl {};
}
template<class T> struct dynamic::GetAddrImpl {};
-template<> struct dynamic::GetAddrImpl<void*> {
- static void** get(Data& d) noexcept { return &d.nul; }
+template<> struct dynamic::GetAddrImpl<std::nullptr_t> {
+ static std::nullptr_t* get(Data& d) noexcept { return &d.nul; }
};
template<> struct dynamic::GetAddrImpl<dynamic::Array> {
static Array* get(Data& d) noexcept { return &d.array; }
};
template<> struct dynamic::GetAddrImpl<dynamic::Array> {
static Array* get(Data& d) noexcept { return &d.array; }
};
// Otherwise, null, being (void*)0, would print as 0.
template <>
};
// Otherwise, null, being (void*)0, would print as 0.
template <>
-struct dynamic::PrintImpl<void*> {
+struct dynamic::PrintImpl<std::nullptr_t> {
static void print(dynamic const& /* d */,
std::ostream& out,
static void print(dynamic const& /* d */,
std::ostream& out,
- void* const& nul) {
- DCHECK_EQ((void*)0, nul);
+ std::nullptr_t const&) {
constexpr dynamic::Type dynamic::TypeInfo<T>::type; \
//
constexpr dynamic::Type dynamic::TypeInfo<T>::type; \
//
-FOLLY_DYNAMIC_DEF_TYPEINFO(void*)
+FOLLY_DYNAMIC_DEF_TYPEINFO(std::nullptr_t)
FOLLY_DYNAMIC_DEF_TYPEINFO(bool)
FOLLY_DYNAMIC_DEF_TYPEINFO(std::string)
FOLLY_DYNAMIC_DEF_TYPEINFO(dynamic::Array)
FOLLY_DYNAMIC_DEF_TYPEINFO(bool)
FOLLY_DYNAMIC_DEF_TYPEINFO(std::string)
FOLLY_DYNAMIC_DEF_TYPEINFO(dynamic::Array)
do { \
switch ((type)) { \
case NULLT: \
do { \
switch ((type)) { \
case NULLT: \
+ apply(std::nullptr_t); \
break; \
case ARRAY: \
apply(Array); \
break; \
case ARRAY: \
apply(Array); \
explicit Data() : nul(nullptr) {}
~Data() {}
explicit Data() : nul(nullptr) {}
~Data() {}
- // XXX: gcc does an ICE if we use std::nullptr_t instead of void*
- // here. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50361
- void* nul;
Array array;
bool boolean;
double doubl;
Array array;
bool boolean;
double doubl;