https://github.com/Endilll created https://github.com/llvm/llvm-project/pull/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. >From 90eb2d7b1a6a7c96bde1e0e63b804ee070e15e90 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov <serebrennikov.vladis...@gmail.com> Date: Sun, 5 Jan 2025 00:35:38 +0300 Subject: [PATCH] [clang] Add test for CWG190 "Layout-compatible POD-struct types" --- clang/test/CXX/drs/cwg1xx.cpp | 21 +++++++++++++++++++-- clang/www/cxx_dr_status.html | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) 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 c069e155fd547c..ca216272147a5f 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