[llvm] [clang] [clang-tools-extra] [clang] Add test for CWG472 (PR #67948)

Vlad Serebrennikov via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 14:19:20 PST 2024


https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/67948

>From ad0df2131e12c59e57b603b955626e27e3067505 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Mon, 2 Oct 2023 08:12:56 +0300
Subject: [PATCH] [clang] Add test for CWG472

---
 clang/test/CXX/drs/dr4xx.cpp | 17 +++++++++++++++++
 clang/www/cxx_dr_status.html |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/clang/test/CXX/drs/dr4xx.cpp b/clang/test/CXX/drs/dr4xx.cpp
index d8bdf49d0b2dde..cc12e9f158061f 100644
--- a/clang/test/CXX/drs/dr4xx.cpp
+++ b/clang/test/CXX/drs/dr4xx.cpp
@@ -924,6 +924,23 @@ namespace dr471 { // dr471: yes
   struct H : B, G { int f() { return n; } }; // expected-error {{private}}
 }
 
+namespace dr472 { // dr472: no drafting
+struct B {
+  int i; // #dr472-i-decl
+};
+struct I : protected B {}; // #dr472-inheritance
+struct D : public I {
+  void f(I *ip) {
+    ip->i = 0;
+    // expected-error at -1                {{'i' is a protected member of 'dr472::B'}}
+    // expected-note@#dr472-inheritance {{constrained by protected inheritance here}}
+    // expected-note@#dr472-i-decl      {{member is declared here}}
+    B *bp = ip;
+    bp->i = 5;
+  }
+};
+}
+
 namespace dr474 { // dr474: yes
   namespace N {
     struct S {
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index ee9712e9bab994..b02f7ccfd37141 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -2871,7 +2871,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td><a href="https://cplusplus.github.io/CWG/issues/472.html">472</a></td>
     <td>drafting</td>
     <td>Casting across protected inheritance</td>
-    <td align="center">Not resolved</td>
+    <td class="none" align="center">No</td>
   </tr>
   <tr id="473">
     <td><a href="https://cplusplus.github.io/CWG/issues/473.html">473</a></td>



More information about the llvm-commits mailing list