diff options
-rw-r--r-- | libcxx/include/__config | 2 | ||||
-rw-r--r-- | libcxx/include/memory | 4 | ||||
-rw-r--r-- | libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/types.pass.cpp | 6 | ||||
-rw-r--r-- | libcxx/test/support/test_macros.h | 2 |
4 files changed, 12 insertions, 2 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config index e28fc5d58d6..bb3624485d9 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -756,7 +756,7 @@ template <unsigned> struct __static_assert_check {}; # elif __cplusplus <= 201402L # define _LIBCPP_STD_VER 14 # else -# define _LIBCPP_STD_VER 15 // current year, or date of c++17 ratification +# define _LIBCPP_STD_VER 16 // current year, or date of c++17 ratification # endif #endif // _LIBCPP_STD_VER diff --git a/libcxx/include/memory b/libcxx/include/memory index 47963e08a0c..50a1f00a5e5 100644 --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -361,6 +361,7 @@ class shared_ptr { public: typedef T element_type; + typedef weak_ptr<T> weak_type; // C++17 // constructors: constexpr shared_ptr() noexcept; @@ -3863,6 +3864,9 @@ class _LIBCPP_TYPE_VIS_ONLY shared_ptr { public: typedef _Tp element_type; +#if _LIBCPP_STD_VER > 14 + typedef weak_ptr<_Tp> weak_type; +#endif private: element_type* __ptr_; __shared_weak_count* __cntrl_; diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/types.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/types.pass.cpp index 8175312334f..f44c05eb7c8 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/types.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/types.pass.cpp @@ -13,14 +13,20 @@ // { // public: // typedef T element_type; +// typedef weak_ptr<T> weak_type; // C++17 // ... // }; #include <memory> +#include "test_macros.h" + struct A; // purposefully incomplete int main() { static_assert((std::is_same<std::shared_ptr<A>::element_type, A>::value), ""); +#if TEST_STD_VER > 14 + static_assert((std::is_same<std::shared_ptr<A>::weak_type, std::weak_ptr<A>>::value), ""); +#endif } diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h index ada4a961ab0..a072e31b77b 100644 --- a/libcxx/test/support/test_macros.h +++ b/libcxx/test/support/test_macros.h @@ -43,7 +43,7 @@ #elif __cplusplus <= 201402L # define TEST_STD_VER 14 #else -# define TEST_STD_VER 99 // greater than current standard +# define TEST_STD_VER 16 // current year; greater than current standard #endif #endif |