diff options
author | Jordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com> | 2019-11-15 12:11:44 -0800 |
---|---|---|
committer | Jordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com> | 2019-11-15 12:11:44 -0800 |
commit | d0e5daf4412e90674866a09951457865c3fa8209 (patch) | |
tree | 38d51abbf540abeae37070af8c5be28cc605f8ed | |
parent | 71ec9f84d84172bb2ab6f0ec48c3fe8cce9f0e67 (diff) | |
download | platform_external_Microsoft-GSL-d0e5daf4412e90674866a09951457865c3fa8209.tar.gz platform_external_Microsoft-GSL-d0e5daf4412e90674866a09951457865c3fa8209.tar.bz2 platform_external_Microsoft-GSL-d0e5daf4412e90674866a09951457865c3fa8209.zip |
fix ctad warning in llvm
-rw-r--r-- | include/gsl/pointers | 9 | ||||
-rw-r--r-- | tests/no_exception_ensure_tests.cpp | 2 | ||||
-rw-r--r-- | tests/no_exception_throw_tests.cpp | 2 |
3 files changed, 10 insertions, 3 deletions
diff --git a/include/gsl/pointers b/include/gsl/pointers index 7373826..2520f9e 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; @@ -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)}; diff --git a/tests/no_exception_ensure_tests.cpp b/tests/no_exception_ensure_tests.cpp index b1ae15b..2ec0ebb 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 b28ad00..ddb6b07 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;
|