Skip to content

Commit 06a9ad3

Browse files
committed
Check noexcept in VariantImpl
1 parent 151688a commit 06a9ad3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

include/aws/crt/Variant.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,16 @@ namespace Aws
178178
VariantDetail::Checker::HasType<typename std::decay<OtherT>::type, Ts...>::value,
179179
int>::type;
180180

181+
using FirstAlternative = typename ThisVariantAlternative<0>::type;
182+
183+
static constexpr bool isFirstAlternativeNothrowDefaultConstructible =
184+
std::is_nothrow_default_constructible<FirstAlternative>::value;
185+
181186
public:
182187
using IndexT = VariantDetail::Index::VariantIndex;
183188
static constexpr std::size_t AlternativeCount = sizeof...(Ts);
184189

185-
VariantImpl()
190+
VariantImpl() noexcept(isFirstAlternativeNothrowDefaultConstructible)
186191
{
187192
using FirstAlternative = typename ThisVariantAlternative<0>::type;
188193
new (m_storage) FirstAlternative();
@@ -669,16 +674,11 @@ namespace Aws
669674
using EnableIfOtherIsThisVariantAlternative = typename std::
670675
enable_if<VariantDetail::Checker::HasType<typename std::decay<OtherT>::type, Ts...>::value, int>::type;
671676

672-
using FirstAlternative = typename ThisVariantAlternative<0>::type;
673-
674-
static constexpr bool isFirstAlternativeNothrowDefaultConstructible =
675-
std::is_nothrow_default_constructible<FirstAlternative>::value;
676-
677677
public:
678678
using IndexT = VariantDetail::Index::VariantIndex;
679679
static constexpr std::size_t AlternativeCount = sizeof...(Ts);
680680

681-
Variant() noexcept(isFirstAlternativeNothrowDefaultConstructible) = default;
681+
Variant() = default;
682682

683683
template <typename T, EnableIfOtherIsThisVariantAlternative<T> = 1> Variant(const T &val) : m_variant(val)
684684
{

0 commit comments

Comments
 (0)