Skip to content

Commit 43e46c5

Browse files
authored
[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
1 parent ad3cda7 commit 43e46c5

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

clang/test/CXX/drs/dr4xx.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,23 @@ namespace dr471 { // dr471: 2.8
10551055
// expected-note@#dr471-G-using {{declared private here}}
10561056
}
10571057

1058+
namespace dr472 { // dr472: no drafting
1059+
struct B {
1060+
int i; // #dr472-i
1061+
};
1062+
struct I : protected B {}; // #dr472-struct-I
1063+
struct D : public I {
1064+
void f(I *ip) {
1065+
ip->i = 0;
1066+
// expected-error@-1 {{'i' is a protected member of 'dr472::B'}}
1067+
// expected-note@#dr472-struct-I {{constrained by protected inheritance here}}
1068+
// expected-note@#dr472-i {{member is declared here}}
1069+
B *bp = ip;
1070+
bp->i = 5;
1071+
}
1072+
};
1073+
}
1074+
10581075
namespace dr474 { // dr474: 3.4
10591076
namespace N {
10601077
struct S {

clang/www/cxx_dr_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2872,7 +2872,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
28722872
<td><a href="https://cplusplus.github.io/CWG/issues/472.html">472</a></td>
28732873
<td>drafting</td>
28742874
<td>Casting across protected inheritance</td>
2875-
<td align="center">Not resolved</td>
2875+
<td class="none" align="center">No</td>
28762876
</tr>
28772877
<tr id="473">
28782878
<td><a href="https://cplusplus.github.io/CWG/issues/473.html">473</a></td>

0 commit comments

Comments
 (0)