diff --git a/src/factory/PVDataCreateFactory.cpp b/src/factory/PVDataCreateFactory.cpp index 6826e62a..883a65f7 100644 --- a/src/factory/PVDataCreateFactory.cpp +++ b/src/factory/PVDataCreateFactory.cpp @@ -30,7 +30,7 @@ using std::min; namespace epics { namespace pvData { - +#if ! (defined(__clang__) && defined(_MSC_VER)) template<> const ScalarType PVBoolean::typeCode = pvBoolean; template<> const ScalarType PVByte::typeCode = pvByte; template<> const ScalarType PVShort::typeCode = pvShort; @@ -56,7 +56,7 @@ template<> const ScalarType PVULongArray::typeCode = pvULong; template<> const ScalarType PVFloatArray::typeCode = pvFloat; template<> const ScalarType PVDoubleArray::typeCode = pvDouble; template<> const ScalarType PVStringArray::typeCode = pvString; - +#endif template PVScalarValue::~PVScalarValue() {} diff --git a/src/pv/pvData.h b/src/pv/pvData.h index a33fb0eb..59cc097e 100644 --- a/src/pv/pvData.h +++ b/src/pv/pvData.h @@ -16,6 +16,9 @@ #include #include #include +#if defined(__clang__) && defined(_MSC_VER) +#include +#endif #include @@ -124,6 +127,36 @@ typedef std::tr1::shared_ptr PVUnionArrayPtrArrayPtr; class PVDataCreate; typedef std::tr1::shared_ptr PVDataCreatePtr; +#if defined(__clang__) && defined(_MSC_VER) +template +constexpr ScalarType typeToCode() { + if (std::is_same::value) + return pvBoolean; + else if (std::is_same::value) + return pvByte; + else if (std::is_same::value) + return pvUByte; + else if (std::is_same::value) + return pvShort; + else if (std::is_same::value) + return pvUShort; + else if (std::is_same::value) + return pvInt; + else if (std::is_same::value) + return pvUInt; + else if (std::is_same::value) + return pvLong; + else if (std::is_same::value) + return pvULong; + else if (std::is_same::value) + return pvFloat; + else if (std::is_same::value) + return pvDouble; + else if (std::is_same::value) + return pvString; +} +#endif + /** * @brief This class is implemented by code that calls setPostHander * @@ -383,7 +416,11 @@ class epicsShareClass PVScalarValue : public PVScalar { typedef T* pointer; typedef const T* const_pointer; + #if defined(__clang__) && defined(_MSC_VER) + constexpr static const ScalarType typeCode = typeToCode(); + #else static const ScalarType typeCode; + #endif /** * Destructor @@ -1184,8 +1221,11 @@ class epicsShareClass PVValueArray : public detail::PVVectorStorage svector; typedef ::epics::pvData::shared_vector const_svector; - + #if defined(__clang__) && defined(_MSC_VER) + constexpr static const ScalarType typeCode = typeToCode(); + #else static const ScalarType typeCode; + #endif /** * Destructor