diff --git a/include/json/value.h b/include/json/value.h index e169c3c..bea2a56 100644 --- a/include/json/value.h +++ b/include/json/value.h @@ -21,6 +21,24 @@ #endif #endif +// Support for '= delete' with template declarations was a late addition +// to the c++11 standard and is rejected by clang 3.8 and Apple clang 8.2 +// even though these declare themselves to be c++11 compilers. +#if !defined(JSONCPP_TEMPLATE_DELETE) +#if defined(__clang__) && defined(__apple_build_version__) +#if __apple_build_version__ <= 8000042 +#define JSONCPP_TEMPLATE_DELETE +#endif +#elif defined(__clang__) +#if __clang_major__ == 3 && __clang_minor__ <= 8 +#define JSONCPP_TEMPLATE_DELETE +#endif +#endif +#if !defined(JSONCPP_TEMPLATE_DELETE) +#define JSONCPP_TEMPLATE_DELETE = delete +#endif +#endif + #include #include #include @@ -390,8 +408,8 @@ public: bool isObject() const; /// The `as` and `is` member function templates and specializations. - template T as() const = delete; - template bool is() const = delete; + template T as() const JSONCPP_TEMPLATE_DELETE; + template bool is() const JSONCPP_TEMPLATE_DELETE; bool isConvertibleTo(ValueType other) const;