Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stl/inc/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -1842,7 +1842,7 @@ void ref(const _Ty&&) = delete;

template <class _Ty>
_NODISCARD _CONSTEXPR20 reference_wrapper<_Ty> ref(reference_wrapper<_Ty> _Val) noexcept {
return _STD ref(_Val.get());
return _Val;
}

template <class _Ty>
Expand All @@ -1855,7 +1855,7 @@ void cref(const _Ty&&) = delete;

template <class _Ty>
_NODISCARD _CONSTEXPR20 reference_wrapper<const _Ty> cref(reference_wrapper<_Ty> _Val) noexcept {
return _STD cref(_Val.get());
return _Val;
}

#if _HAS_CXX20
Expand Down
1 change: 1 addition & 0 deletions tests/std/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ tests\GH_002058_debug_iterator_race
tests\GH_002120_streambuf_seekpos_and_seekoff
tests\LWG2597_complex_branch_cut
tests\LWG3018_shared_ptr_function
tests\LWG3146_excessive_unwrapping_ref_cref
tests\LWG3422_seed_seq_ctors
tests\LWG3480_directory_iterator_range
tests\P0019R8_atomic_ref
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\usual_matrix.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <functional>
#include <type_traits>

using namespace std;

void test_LWG_3146() {
int i = 0;
reference_wrapper<int> ri(i);
reference_wrapper<reference_wrapper<int>> rri(ri);

auto reference = ref(rri);
auto const_reference = cref(rri);

static_assert(
is_same_v<decltype(reference), reference_wrapper<reference_wrapper<int>>>, "LWG-3146 is not implemented");
static_assert(is_same_v<decltype(const_reference), reference_wrapper<const reference_wrapper<int>>>,
"LWG-3146 is not implemented");
}

int main() {} // COMPILE-ONLY