diff --git a/include/gsl/pointers b/include/gsl/pointers index 73738269..7afed1cf 100644 --- a/include/gsl/pointers +++ b/include/gsl/pointers @@ -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; @@ -272,6 +272,14 @@ auto make_strict_not_null(T&& t) { return strict_not_null>>{std::forward(t)}; } +#if ( defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201611L) ) + +// deduction guides to prevent the ctad-maybe-unsupported warning +template not_null(T) -> not_null; +template strict_not_null(T) -> strict_not_null; + +#endif // ( defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201611L) ) + } // namespace gsl namespace std diff --git a/tests/no_exception_ensure_tests.cpp b/tests/no_exception_ensure_tests.cpp index b1ae15b1..2ec0ebb7 100644 --- a/tests/no_exception_ensure_tests.cpp +++ b/tests/no_exception_ensure_tests.cpp @@ -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; diff --git a/tests/no_exception_throw_tests.cpp b/tests/no_exception_throw_tests.cpp index b28ad00d..ddb6b07e 100644 --- a/tests/no_exception_throw_tests.cpp +++ b/tests/no_exception_throw_tests.cpp @@ -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;