Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bd0aad5

Browse files
authored
[clang][NFC] Mark CWG988 as implemented and add a test (#196889)
[CWG988](https://wg21.link/cwg988) specifies that reference collapsing is performed when trying to form a reference to a `decltype`. Clang implements this since 2.7: https://godbolt.org/z/vYzKbv8x7 (and I checked a few versions after that to make sure there were no regressions).
1 parent cc4922b commit bd0aad5

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

clang/test/CXX/drs/cwg9xx.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,17 @@ enum struct E4 : int { e = static_cast<int>(E4()) };
169169
#endif
170170
} // namespace cwg977
171171

172+
namespace cwg988 { // cwg988: 2.7
173+
#if __cplusplus >= 201103L
174+
void f(int& lvalue_ref, int&& rvalue_ref) {
175+
static_assert(__is_same(decltype(lvalue_ref)&, int&), "");
176+
static_assert(__is_same(decltype(lvalue_ref)&&, int&), "");
177+
static_assert(__is_same(decltype(rvalue_ref)&, int&), "");
178+
static_assert(__is_same(decltype(rvalue_ref)&&, int&&), "");
179+
}
180+
#endif
181+
} // namespace cwg988
182+
172183
namespace cwg990 { // cwg990: 3.5
173184
#if __cplusplus >= 201103L
174185
struct A { // #cwg990-A

clang/www/cxx_dr_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6693,7 +6693,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
66936693
<td>[<a href="https://wg21.link/dcl.type.simple">dcl.type.simple</a>]</td>
66946694
<td>CD2</td>
66956695
<td>Reference-to-reference collapsing with <TT>decltype</TT></td>
6696-
<td class="unknown" align="center">Unknown</td>
6696+
<td class="full" align="center">Clang 2.7</td>
66976697
</tr>
66986698
<tr id="989">
66996699
<td><a href="https://cplusplus.github.io/CWG/issues/989.html">989</a></td>

0 commit comments

Comments
 (0)