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

2024-01-14 Thread via cfe-commits


@@ -2871,7 +2871,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/472.html;>472
 drafting
 Casting across protected inheritance
-Not resolved
+No

cor3ntin wrote:

> For `"no drafting" status, can we say something different here? I think 
> something like "Not resolved, probably no" would be better, given that we 
> don't actually know what the resolution will be, and if it ends up resolved 
> NAD then we actually do implement it correctly :-)

I think that would make sense. Any opinion @AaronBallman ?

https://github.com/llvm/llvm-project/pull/67948
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2024-01-12 Thread Vlad Serebrennikov via cfe-commits


@@ -2871,7 +2871,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/472.html;>472
 drafting
 Casting across protected inheritance
-Not resolved
+No

Endilll wrote:

Current state of things is my fault (I was the one who introduced `no open`, 
`no drafting`, and `no review` statuses). I've been pondering on a different 
idea recently: `No*`, and a pop-up saying something along the lines of 
`Tentative; issue hasn't been resolved yet`. Like cppreference does in their 
compiler support table. Seems less heavy for such a big table, but still 
provides details for those who are interested.

Another idea is for `No` to be a link to an issue on bug tracker instead of a 
pop-up.

It also worth mentioning that `make_cxx_dr_status` is strict with those 
unresolved statuses, and it yells every time status in a test doesn't match 
status in `cwg_index.html`.

https://github.com/llvm/llvm-project/pull/67948
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2024-01-12 Thread Richard Smith via cfe-commits


@@ -2871,7 +2871,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/472.html;>472
 drafting
 Casting across protected inheritance
-Not resolved
+No

zygoloid wrote:

For `"no drafting" status, can we say something different here? I think 
something like "Not resolved, probably no" would be better, given that we don't 
actually know what the resolution will be, and if it ends up resolved NAD then 
we actually do implement it correctly :-)

https://github.com/llvm/llvm-project/pull/67948
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2024-01-12 Thread Richard Smith via cfe-commits

zygoloid wrote:

> None of the implementations seem to agree with the resolution of the DR: 
> https://godbolt.org/z/a7nEvW5Gr

Yeah, I think this is a case where the wording is clear and everyone implements 
it, but it doesn't actually do the right thing. The example in the issue "ought 
to be" ill-formed, because as the issue points out, there's no reason to think 
that the N object is actually a base subobject of P, so access to its protected 
base B shouldn't be granted to a P object.

I think a rule even more similar to [class.protected] should be implemented: if 
we rely on a conversion from a class `N` to a class `B`, if `N` is a protected 
base class of `B` (if a public member of `B` would be a protected member of 
`N`), then additionally require that `N` is either `C` or a class derived from 
`C` (where `C` is the class granting access, as in [class.protected]).

I'd suggest we implement that as a warning, given that the standard is clear 
and other implementers accept.

In any case, this new testcase looks good to me, and would be good to add 
regardless of what CWG ends up deciding here (if they ever make a decision...).

https://github.com/llvm/llvm-project/pull/67948
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2024-01-11 Thread via cfe-commits

cor3ntin wrote:

After additional archeology, I found the following minutes from Portland , 2012

> Core issue 472: Casting across protected inheritance
> _ Would the example work if P2 derived privately from N2?
> _ ... Yes.. Hm, that was a good point.
> redrafting.


Given that, I'd rather we don't try to read the tea leaves.
If we think this is important enough to fix, we should ping CWG.
But there seems to be some consistency across implementations, so I think we 
should punt work on this issue.

@zygoloid 


https://github.com/llvm/llvm-project/pull/67948
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Add test for CWG472 (PR #67948)

2023-10-02 Thread Vlad Serebrennikov via cfe-commits

Endilll wrote:

> None of the implementations seem to agree with the resolution of the DR: 
> https://godbolt.org/z/a7nEvW5Gr

It's definitely not the first time CWG goes against every major implementation 
with their DR resolution.

https://github.com/llvm/llvm-project/pull/67948
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Add test for CWG472 (PR #67948)

2023-10-02 Thread Shafik Yaghmour via cfe-commits

https://github.com/shafik commented:

None of the implementations seem to agree with the resolution of the DR: 
https://godbolt.org/z/a7nEvW5Gr

https://github.com/llvm/llvm-project/pull/67948
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Add test for CWG472 (PR #67948)

2023-10-02 Thread via cfe-commits

cor3ntin wrote:

CC @zygoloid 
In the proposed resolution, i do not understand why `B* bp = n2p;` should be 
ill-formed by virtue of being declared in `P2`

https://github.com/llvm/llvm-project/pull/67948
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Add test for CWG472 (PR #67948)

2023-10-01 Thread Vlad Serebrennikov via cfe-commits

https://github.com/Endilll edited 
https://github.com/llvm/llvm-project/pull/67948
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Add test for CWG472 (PR #67948)

2023-10-01 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang


Changes

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

---
Full diff: https://github.com/llvm/llvm-project/pull/67948.diff


2 Files Affected:

- (modified) clang/test/CXX/drs/dr4xx.cpp (+17) 
- (modified) clang/www/cxx_dr_status.html (+1-1) 


``diff
diff --git a/clang/test/CXX/drs/dr4xx.cpp b/clang/test/CXX/drs/dr4xx.cpp
index d8bdf49d0b2dde7..cc12e9f158061f8 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@-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 ee9712e9bab9949..b02f7ccfd371411 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -2871,7 +2871,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/472.html;>472
 drafting
 Casting across protected inheritance
-Not resolved
+No
   
   
 https://cplusplus.github.io/CWG/issues/473.html;>473

``




https://github.com/llvm/llvm-project/pull/67948
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Add test for CWG472 (PR #67948)

2023-10-01 Thread Vlad Serebrennikov via cfe-commits

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

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

>From ad0df2131e12c59e57b603b955626e27e3067505 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov 
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 d8bdf49d0b2dde7..cc12e9f158061f8 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@-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 ee9712e9bab9949..b02f7ccfd371411 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -2871,7 +2871,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/472.html;>472
 drafting
 Casting across protected inheritance
-Not resolved
+No
   
   
 https://cplusplus.github.io/CWG/issues/473.html;>473

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits