Silence clang warning in <variant> (#768)

Clang complains about an "unnecessary" lambda capture despite that the capture is used in a discarded statement (LLVM-45398).
This commit is contained in:
Casey Carter 2020-04-30 12:12:55 -07:00 коммит произвёл GitHub
Родитель d7f855891b
Коммит f0f0b55d57
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -1143,6 +1143,10 @@ public:
using _Mybase::valueless_by_exception; using _Mybase::valueless_by_exception;
// swap [variant.swap] // swap [variant.swap]
#ifdef __clang__ // TRANSITION, LLVM-45398
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-lambda-capture"
#endif // TRANSITION, LLVM-45398
void swap(variant& _That) noexcept( void swap(variant& _That) noexcept(
conjunction_v<is_nothrow_move_constructible<_Types>..., is_nothrow_swappable<_Types>...>) { conjunction_v<is_nothrow_move_constructible<_Types>..., is_nothrow_swappable<_Types>...>) {
// exchange the contained values if *this and _That hold the same alternative, otherwise exchange the values of // exchange the contained values if *this and _That hold the same alternative, otherwise exchange the values of
@ -1219,6 +1223,9 @@ public:
} }
} }
} }
#ifdef __clang__ // TRANSITION, LLVM-45398
#pragma clang diagnostic pop
#endif // TRANSITION, LLVM-45398
private: private:
template <size_t _Idx, class... _ArgTypes> template <size_t _Idx, class... _ArgTypes>