File tree Expand file tree Collapse file tree 3 files changed +30
-8
lines changed
smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers Expand file tree Collapse file tree 3 files changed +30
-8
lines changed Original file line number Diff line number Diff line change @@ -53,10 +53,7 @@ _LIBCPP_PUSH_MACROS
53
53
_LIBCPP_BEGIN_NAMESPACE_STD
54
54
55
55
#ifndef _LIBCPP_CXX03_LANG
56
- // Dereferencing _Ptr directly in noexcept fails for a void pointer.
57
- // This is not SFINAE-ed away leading to a hard error.
58
- // The issue was originally triggered by
59
- // test/std/utilities/memory/unique.ptr/iterator_concept_conformance.compile.pass.cpp
56
+
60
57
template <class _Ptr >
61
58
struct __is_noexcept_deref_or_void {
62
59
static constexpr bool value = noexcept (*std::declval<_Ptr>());
@@ -269,10 +266,7 @@ class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS unique_ptr {
269
266
}
270
267
271
268
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t <_Tp> operator *() const
272
- #ifndef _LIBCPP_CXX03_LANG
273
- noexcept (__is_noexcept_deref_or_void<pointer>::value)
274
- #endif
275
- {
269
+ _NOEXCEPT_ (__is_noexcept_deref_or_void<pointer>::value) {
276
270
return *__ptr_.first ();
277
271
}
278
272
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer operator ->() const _NOEXCEPT { return __ptr_.first (); }
Original file line number Diff line number Diff line change
1
+ // ===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ // ===----------------------------------------------------------------------===//
8
+
9
+ // UNSUPPORTED: c++03
10
+
11
+ // unique_ptr
12
+
13
+ // add_lvalue_reference_t<T> operator*() const noexcept(noexcept(*declval<pointer>()));
14
+
15
+ // Dereferencing pointer directly in noexcept fails for a void pointer. This
16
+ // is not SFINAE-ed away leading to a hard error. The issue was originally
17
+ // triggered by
18
+ // test/std/utilities/memory/unique.ptr/iterator_concept_conformance.compile.pass.cpp
19
+ //
20
+ // This test validates whether the code compiles.
21
+
22
+ #include < memory>
23
+
24
+ extern const std::unique_ptr<void > p;
25
+ void f () { [[maybe_unused]] bool b = noexcept (p.operator *()); }
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ struct Deleter {
32
32
33
33
TEST_CONSTEXPR_CXX23 bool test () {
34
34
ASSERT_NOEXCEPT (*(std::unique_ptr<void >{}));
35
+ #if TEST_STD_VER >= 11
36
+ static_assert (noexcept (*std::declval<std::unique_ptr<void >>()), " " );
37
+ #endif
35
38
{
36
39
std::unique_ptr<int > p (new int (3 ));
37
40
assert (*p == 3 );
You can’t perform that action at this time.
0 commit comments