Skip to content

Commit c87dcde

Browse files
committed
only use constexpr with clang-cl
1 parent c09f6d8 commit c87dcde

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/factory/PVDataCreateFactory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ using std::min;
3030

3131
namespace epics { namespace pvData {
3232

33-
#if __cplusplus < 201103L
33+
#if ! (defined(__clang__) && defined(_MSC_VER))
3434
template<> const ScalarType PVBoolean::typeCode = pvBoolean;
3535
template<> const ScalarType PVByte::typeCode = pvByte;
3636
template<> const ScalarType PVShort::typeCode = pvShort;

src/pv/pvData.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <iterator>
1717
#include <iostream>
1818
#include <iomanip>
19-
#if __cplusplus >= 201103L
19+
#if defined(__clang__) && defined(_MSC_VER)
2020
#include <type_traits>
2121
#endif
2222

@@ -127,7 +127,7 @@ typedef std::tr1::shared_ptr<PVUnionArrayPtrArray> PVUnionArrayPtrArrayPtr;
127127
class PVDataCreate;
128128
typedef std::tr1::shared_ptr<PVDataCreate> PVDataCreatePtr;
129129

130-
#if __cplusplus >= 201103L
130+
#if defined(__clang__) && defined(_MSC_VER)
131131
template <typename T>
132132
constexpr ScalarType typeToCode() {
133133
if (std::is_same<T, boolean>::value)
@@ -416,10 +416,10 @@ class epicsShareClass PVScalarValue : public PVScalar {
416416
typedef T* pointer;
417417
typedef const T* const_pointer;
418418

419-
#if __cplusplus < 201103L
420-
static const ScalarType typeCode;
421-
#else
419+
#if defined(__clang__) && defined(_MSC_VER)
422420
constexpr static const ScalarType typeCode = typeToCode<T>();
421+
#else
422+
static const ScalarType typeCode;
423423
#endif
424424

425425
/**
@@ -1221,10 +1221,10 @@ class epicsShareClass PVValueArray : public detail::PVVectorStorage<T,PVScalarAr
12211221
typedef ::epics::pvData::shared_vector<T> svector;
12221222
typedef ::epics::pvData::shared_vector<const T> const_svector;
12231223

1224-
#if __cplusplus < 201103L
1225-
static const ScalarType typeCode;
1226-
#else
1224+
#if defined(__clang__) && defined(_MSC_VER)
12271225
constexpr static const ScalarType typeCode = typeToCode<T>();
1226+
#else
1227+
static const ScalarType typeCode;
12281228
#endif
12291229

12301230
/**

0 commit comments

Comments
 (0)