Skip to content

Commit 9f19b67

Browse files
committed
Bug#26742948 Fix variant copy constructor.
1 parent cd5ee3b commit 9f19b67

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

cdk/include/mysql/cdk/foundation/variant.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class variant_base<Size, Align, First, Rest...>
9090
Rest...
9191
> Base;
9292

93-
bool m_owns;
93+
bool m_owns = false;
9494

9595
protected:
9696

@@ -115,28 +115,26 @@ class variant_base<Size, Align, First, Rest...>
115115
template<typename T>
116116
variant_base(T &&val)
117117
: Base(std::move(val))
118-
, m_owns(false)
119118
{}
120119

121120
template<typename T>
122121
variant_base(const T &val)
123122
: Base(val)
124-
, m_owns(false)
125123
{}
126124

127125

128126
// Copy/move semantics
129127

130128
variant_base(const variant_base &other)
131-
: Base(other)
129+
: Base(static_cast<const Base&>(other))
132130
{
133131
if (!other.m_owns)
134132
return;
135133
set(*other.get((First*)nullptr));
136134
}
137135

138136
variant_base(variant_base &&other)
139-
: Base(std::move(other))
137+
: Base(std::move(static_cast<const Base&&>(other)))
140138
{
141139
if (!other.m_owns)
142140
return;

0 commit comments

Comments
 (0)