fix ctad warning in llvm

This commit is contained in:
Jordan Maples [MSFT] 2019-11-15 12:11:44 -08:00
parent 71ec9f84d8
commit d0e5daf441
3 changed files with 10 additions and 3 deletions

View File

@ -100,7 +100,7 @@ public:
constexpr operator T() const { return get(); }
constexpr T operator->() const { return get(); }
constexpr decltype(auto) operator*() const { return *get(); }
constexpr decltype(auto) operator*() const { return *get(); }
// prevents compilation when someone attempts to assign a null pointer constant
not_null(std::nullptr_t) = delete;
@ -119,6 +119,13 @@ private:
T ptr_;
};
#if (defined(__cplusplus) && (__cplusplus >= 201703L))
// deduction guide to prevent the ctad-maybe-unsupported warning
template <class T>
not_null(T ptr) -> not_null<T>;
#endif (defined(__cplusplus) && (__cplusplus >= 201703L))
template <class T>
auto make_not_null(T&& t) {
return not_null<std::remove_cv_t<std::remove_reference_t<T>>>{std::forward<T>(t)};

View File

@ -28,7 +28,7 @@ int operator_subscript_no_throw() noexcept
void setup_termination_handler() noexcept
{
#if defined(_MSC_VER)
#if defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND)
auto& handler = gsl::details::get_terminate_handler();
handler = &test_terminate;

View File

@ -28,7 +28,7 @@ int narrow_no_throw()
void setup_termination_handler() noexcept
{
#if defined(_MSC_VER)
#if defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND)
auto& handler = gsl::details::get_terminate_handler();
handler = &test_terminate;