Skip to content

Commit

Permalink
[clang] Add test for CWG2267 (#67931)
Browse files Browse the repository at this point in the history
  • Loading branch information
Endilll committed Oct 2, 2023
1 parent 2d4de5a commit c2fd3eb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions clang/test/CXX/drs/dr22xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,28 @@ namespace CheckAfterMerging2 {
#endif
} // namespace dr2233

namespace dr2267 { // dr2267: no
#if __cplusplus >= 201103L
struct A {} a;
struct B { explicit B(const A&); }; // #dr2267-struct-B

struct D { D(); };
struct C { explicit operator D(); } c;

B b1(a);
const B &b2{a}; // FIXME ill-formed
const B &b3(a);
// expected-error@-1 {{no viable conversion from 'struct A' to 'const B'}}
// expected-note@#dr2267-struct-B {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'struct A' to 'const B &' for 1st argument}}
// expected-note@#dr2267-struct-B {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'struct A' to 'B &&' for 1st argument}}
// expected-note@#dr2267-struct-B {{explicit constructor is not a candidate}}

D d1(c);
const D &d2{c}; // FIXME ill-formed
const D &d3(c); // FIXME ill-formed
#endif
}

namespace dr2292 { // dr2292: 9
#if __cplusplus >= 201103L
template<typename T> using id = T;
Expand Down
2 changes: 1 addition & 1 deletion clang/www/cxx_dr_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -13409,7 +13409,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/2267.html">2267</a></td>
<td>CD5</td>
<td>Copy-initialization of temporary in reference direct-initialization</td>
<td class="none" align="center">Unknown</td>
<td class="none" align="center">No</td>
</tr>
<tr id="2268">
<td><a href="https://cplusplus.github.io/CWG/issues/2268.html">2268</a></td>
Expand Down

0 comments on commit c2fd3eb

Please sign in to comment.