[clang] 43e46c5 - [clang] Add test for CWG472 (#67948)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 25 07:00:23 PST 2024


Author: Vlad Serebrennikov
Date: 2024-01-25T19:00:17+04:00
New Revision: 43e46c546a1f0c7c3e436104a974560c6a2e5188

URL: https://github.com/llvm/llvm-project/commit/43e46c546a1f0c7c3e436104a974560c6a2e5188
DIFF: https://github.com/llvm/llvm-project/commit/43e46c546a1f0c7c3e436104a974560c6a2e5188.diff

LOG: [clang] Add test for CWG472 (#67948)

https://cplusplus.github.io/CWG/issues/472.html
It has drafting status, but I think CWG has reached consesus on the
behavior.
Related: #16602

Added: 
    

Modified: 
    clang/test/CXX/drs/dr4xx.cpp
    clang/www/cxx_dr_status.html

Removed: 
    


################################################################################
diff  --git a/clang/test/CXX/drs/dr4xx.cpp b/clang/test/CXX/drs/dr4xx.cpp
index aa7a41b95ccd85..2f11c92f86aca3 100644
--- a/clang/test/CXX/drs/dr4xx.cpp
+++ b/clang/test/CXX/drs/dr4xx.cpp
@@ -1055,6 +1055,23 @@ namespace dr471 { // dr471: 2.8
   //   expected-note@#dr471-G-using {{declared private here}}
 }
 
+namespace dr472 { // dr472: no drafting
+struct B {
+  int i; // #dr472-i
+};
+struct I : protected B {}; // #dr472-struct-I
+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-struct-I {{constrained by protected inheritance here}}
+    //   expected-note@#dr472-i {{member is declared here}}
+    B *bp = ip;
+    bp->i = 5;
+  }
+};
+}
+
 namespace dr474 { // dr474: 3.4
   namespace N {
     struct S {

diff  --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index c9d21f096a34c6..3e13a4d89ef989 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -2872,7 +2872,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 cfe-commits mailing list