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 /include | |
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
Diffstat (limited to 'include')
-rw-r--r-- | include/gsl/pointers | 9 |
1 files changed, 8 insertions, 1 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)}; |