[clang] [clang] Add test for CWG2267 (PR #67931)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 1 11:50:05 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
<details>
<summary>Changes</summary>
Related: #<!-- -->63416
---
Full diff: https://github.com/llvm/llvm-project/pull/67931.diff
2 Files Affected:
- (modified) clang/test/CXX/drs/dr22xx.cpp (+22)
- (modified) clang/www/cxx_dr_status.html (+1-1)
``````````diff
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 ee9712e9bab9949..49386bbbc44c80f 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>
``````````
</details>
https://github.com/llvm/llvm-project/pull/67931
More information about the cfe-commits
mailing list