Author: Vlad Serebrennikov Date: 2025-01-05T10:29:31+04:00 New Revision: 267ab1cf574bd51d67f3f88c1c4f28a44fca2c8a
URL: https://github.com/llvm/llvm-project/commit/267ab1cf574bd51d67f3f88c1c4f28a44fca2c8a DIFF: https://github.com/llvm/llvm-project/commit/267ab1cf574bd51d67f3f88c1c4f28a44fca2c8a.diff LOG: [clang] Add test for CWG190 "Layout-compatible POD-struct types" (#121668) This patch adds test for [CWG190](https://cplusplus.github.io/CWG/issues/190.html), leveraging `__is_layout_compatible` intrinsic added for C++20 `std::is_layout_compatible`. I conservatively set the status to Clang 19, as it's the first release that implemented said intrinsic. Added: Modified: clang/test/CXX/drs/cwg1xx.cpp clang/www/cxx_dr_status.html Removed: ################################################################################ diff --git a/clang/test/CXX/drs/cwg1xx.cpp b/clang/test/CXX/drs/cwg1xx.cpp index 6aec8b65c91f12..939de6dee06d38 100644 --- a/clang/test/CXX/drs/cwg1xx.cpp +++ b/clang/test/CXX/drs/cwg1xx.cpp @@ -1314,8 +1314,25 @@ namespace cwg188 { // cwg188: yes static_assert(sizeof(0, c) == 10, ""); } -// cwg190 FIXME: add codegen test for tbaa -// or implement C++20 std::is_layout_compatible and test it this way +namespace cwg190 { // cwg190: 19 +struct A { + int a; + static double x; + int b; + void y(); + int c; +}; + +struct B { + int a; + void y(); + int b; + static double x; + int c; +}; + +static_assert(__is_layout_compatible(A, B), ""); +} // namespace cwg190 int cwg191_j; namespace cwg191 { // cwg191: yes diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index 6f42d10e4c187c..335442c6e605f8 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -1185,7 +1185,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2> <td><a href="https://cplusplus.github.io/CWG/issues/190.html">190</a></td> <td>TC1</td> <td>Layout-compatible POD-struct types</td> - <td class="unknown" align="center">Unknown</td> + <td class="full" align="center">Clang 19</td> </tr> <tr id="191"> <td><a href="https://cplusplus.github.io/CWG/issues/191.html">191</a></td> _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits