[clang] c2fd3eb - [clang] Add test for CWG2267 (#67931)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 2 09:00:47 PDT 2023
Author: Vlad Serebrennikov
Date: 2023-10-02T20:00:41+04:00
New Revision: c2fd3ebe83444de05482d5a5a332dc2cf0db1a92
URL: https://github.com/llvm/llvm-project/commit/c2fd3ebe83444de05482d5a5a332dc2cf0db1a92
DIFF: https://github.com/llvm/llvm-project/commit/c2fd3ebe83444de05482d5a5a332dc2cf0db1a92.diff
LOG: [clang] Add test for CWG2267 (#67931)
https://cplusplus.github.io/CWG/issues/2267.html
Related: #63416
Added:
Modified:
clang/test/CXX/drs/dr22xx.cpp
clang/www/cxx_dr_status.html
Removed:
################################################################################
diff --git a/clang/test/CXX/drs/dr22xx.cpp b/clang/test/CXX/drs/dr22xx.cpp
index 414925f0d74cc2e..cd849443b1119ba 100644
--- a/clang/test/CXX/drs/dr22xx.cpp
+++ b/clang/test/CXX/drs/dr22xx.cpp
@@ -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 at -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;
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 2617a2e6f7a86be..0ca35f1f5679a34 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -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>
More information about the cfe-commits
mailing list