Skip to content

Commit 1e70fdc

Browse files
authored
Fix compile error in c++20 (#510)
In c++20, more constraints are applied: * constructor and destructor are not allowed to have template id * adding two enum value needs explicit convertion
1 parent 472db76 commit 1e70fdc

File tree

21 files changed

+54
-69
lines changed

21 files changed

+54
-69
lines changed

src/backend/gporca/libgpopt/include/gpopt/base/CStateMachine.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,10 @@ class CStateMachine
254254
}
255255

256256
public:
257-
CStateMachine<TEnumState, tenumstateSentinel, TEnumEvent,
258-
tenumeventSentinel>(
259-
const CStateMachine<TEnumState, tenumstateSentinel, TEnumEvent,
260-
tenumeventSentinel> &) = delete;
257+
CStateMachine(const CStateMachine &) = delete;
261258

262259
// ctor
263-
CStateMachine<TEnumState, tenumstateSentinel, TEnumEvent,
264-
tenumeventSentinel>()
260+
CStateMachine()
265261
: m_tenumstate(TesInitial())
266262
{
267263
GPOS_ASSERT(0 < tenumstateSentinel && 0 < tenumeventSentinel &&

src/backend/gporca/libgpopt/include/gpopt/search/CJobStateMachine.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ class CJobStateMachine
9595
CJobStateMachine(const CJobStateMachine &) = delete;
9696

9797
// ctor
98-
CJobStateMachine<TEnumState, estSentinel, TEnumEvent, eevSentinel>() =
99-
default;
98+
CJobStateMachine() = default;
10099

101100
// dtor
102101
~CJobStateMachine() = default;

src/backend/gporca/libgpopt/include/gpopt/xforms/CXform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "naucrates/traceflags/traceflags.h"
2626

2727
// Macro for enabling and disabling xforms
28-
#define GPOPT_DISABLE_XFORM_TF(x) EopttraceDisableXformBase + x
28+
#define GPOPT_DISABLE_XFORM_TF(x) EopttraceDisableXformBase + static_cast<int>(x)
2929
#define GPOPT_ENABLE_XFORM(x) GPOS_UNSET_TRACE(GPOPT_DISABLE_XFORM_TF(x))
3030
#define GPOPT_DISABLE_XFORM(x) GPOS_SET_TRACE(GPOPT_DISABLE_XFORM_TF(x))
3131
#define GPOPT_FENABLED_XFORM(x) !GPOS_FTRACE(GPOPT_DISABLE_XFORM_TF(x))

src/backend/gporca/libgpopt/include/gpopt/xforms/CXformApply2Join.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ class CXformApply2Join : public CXformExploration
257257
CXformApply2Join(const CXformApply2Join &) = delete;
258258

259259
// ctor for deep pattern
260-
explicit CXformApply2Join<TApply, TJoin>(CMemoryPool *mp, BOOL)
260+
explicit CXformApply2Join(CMemoryPool *mp, BOOL)
261261
: // pattern
262262
CXformExploration(GPOS_NEW(mp) CExpression(
263263
mp, GPOS_NEW(mp) TApply(mp),
@@ -272,7 +272,7 @@ class CXformApply2Join : public CXformExploration
272272
}
273273

274274
// ctor for shallow pattern
275-
explicit CXformApply2Join<TApply, TJoin>(CMemoryPool *mp)
275+
explicit CXformApply2Join(CMemoryPool *mp)
276276
: // pattern
277277
CXformExploration(GPOS_NEW(mp) CExpression(
278278
mp, GPOS_NEW(mp) TApply(mp),
@@ -287,14 +287,13 @@ class CXformApply2Join : public CXformExploration
287287
}
288288

289289
// ctor for passed pattern
290-
CXformApply2Join<TApply, TJoin>(CMemoryPool *, // mp
291-
CExpression *pexprPattern)
290+
CXformApply2Join(CMemoryPool * /* mp */, CExpression *pexprPattern)
292291
: CXformExploration(pexprPattern)
293292
{
294293
}
295294

296295
// dtor
297-
~CXformApply2Join<TApply, TJoin>() override = default;
296+
~CXformApply2Join() override = default;
298297

299298
// is transformation an Apply decorrelation (Apply To Join) xform?
300299
BOOL

src/backend/gporca/libgpos/include/gpos/common/CAutoP.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ class CAutoP : public CStackObject
3939
T *m_object;
4040

4141
public:
42-
CAutoP<T>(const CAutoP &) = delete;
42+
CAutoP(const CAutoP &) = delete;
4343

4444
// ctor
45-
explicit CAutoP<T>() : m_object(nullptr)
45+
explicit CAutoP() : m_object(nullptr)
4646
{
4747
}
4848

49-
explicit CAutoP<T>(T *object) : m_object(object)
49+
explicit CAutoP(T *object) : m_object(object)
5050
{
5151
}
5252

src/backend/gporca/libgpos/include/gpos/common/CAutoRef.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ class CAutoRef : public CAutoP<T>
3030
{
3131
private:
3232
public:
33-
CAutoRef<T>(const CAutoRef &) = delete;
33+
CAutoRef(const CAutoRef &) = delete;
3434

3535
// ctor
36-
explicit CAutoRef<T>() : CAutoP<T>()
36+
explicit CAutoRef() : CAutoP<T>()
3737
{
3838
}
3939

4040
// ctor
41-
explicit CAutoRef<T>(T *object) : CAutoP<T>(object)
41+
explicit CAutoRef(T *object) : CAutoP<T>(object)
4242
{
4343
}
4444

src/backend/gporca/libgpos/include/gpos/common/CAutoRg.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ class CAutoRg : public CStackObject
3434
T *m_object_array;
3535

3636
public:
37-
CAutoRg<T>(const CAutoRg &) = delete;
37+
CAutoRg(const CAutoRg &) = delete;
3838

3939
// ctor
40-
explicit CAutoRg<T>() : m_object_array(nullptr)
40+
explicit CAutoRg() : m_object_array(nullptr)
4141
{
4242
}
4343

4444
// ctor
45-
explicit CAutoRg<T>(T *object_array) : m_object_array(object_array)
45+
explicit CAutoRg(T *object_array) : m_object_array(object_array)
4646
{
4747
}
4848

src/backend/gporca/libgpos/include/gpos/common/CDynamicPtrArray.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,10 @@ class CDynamicPtrArray : public CRefCount
145145
}
146146

147147
public:
148-
CDynamicPtrArray<T, CleanupFn>(const CDynamicPtrArray<T, CleanupFn> &) =
149-
delete;
148+
CDynamicPtrArray(const CDynamicPtrArray &) = delete;
150149

151150
// ctor
152-
explicit CDynamicPtrArray<T, CleanupFn>(CMemoryPool *mp, ULONG min_size = 4,
151+
explicit CDynamicPtrArray(CMemoryPool *mp, ULONG min_size = 4,
153152
ULONG expansion_factor = 10)
154153
: m_mp(mp),
155154
m_capacity(0),
@@ -165,7 +164,7 @@ class CDynamicPtrArray : public CRefCount
165164
}
166165

167166
// dtor
168-
~CDynamicPtrArray<T, CleanupFn>() override
167+
~CDynamicPtrArray() override
169168
{
170169
Clear();
171170

src/backend/gporca/libgpos/include/gpos/common/CEnumSet.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ class CEnumSet : public CBitSet
3030
{
3131
private:
3232
public:
33-
CEnumSet<T, sentinel_index>(const CEnumSet<T, sentinel_index> &) = delete;
33+
CEnumSet(const CEnumSet &) = delete;
3434

3535
// ctor
36-
explicit CEnumSet<T, sentinel_index>(CMemoryPool *mp)
36+
explicit CEnumSet(CMemoryPool *mp)
3737
: CBitSet(mp, sentinel_index)
3838
{
3939
}
4040

41-
explicit CEnumSet<T, sentinel_index>(
42-
CMemoryPool *mp, const CEnumSet<T, sentinel_index> &enum_set)
41+
explicit CEnumSet(
42+
CMemoryPool *mp, const CEnumSet &enum_set)
4343
: CBitSet(mp, enum_set)
4444
{
4545
}
4646

4747
// dtor
48-
~CEnumSet<T, sentinel_index>() override = default;
48+
~CEnumSet() override = default;
4949

5050
// determine if bit is set
5151
BOOL

src/backend/gporca/libgpos/include/gpos/common/CEnumSetIter.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,17 @@ class CEnumSetIter : public CBitSetIter
3030
{
3131
private:
3232
public:
33-
CEnumSetIter<T, sentinel_index>(const CEnumSetIter<T, sentinel_index> &) =
34-
delete;
33+
CEnumSetIter(const CEnumSetIter &) = delete;
3534

3635
// ctor
37-
explicit CEnumSetIter<T, sentinel_index>(
36+
explicit CEnumSetIter(
3837
const CEnumSet<T, sentinel_index> &enum_set)
3938
: CBitSetIter(enum_set)
4039
{
4140
}
4241

4342
// dtor
44-
~CEnumSetIter<T, sentinel_index>() = default;
43+
~CEnumSetIter() = default;
4544

4645
// current enum
4746
T

0 commit comments

Comments
 (0)