Author: Vlad Serebrennikov Date: 2022-12-06T12:27:22+03:00 New Revision: 5b22c5129c11f5c762c5092d7c52e1ac3d536903
URL: https://github.com/llvm/llvm-project/commit/5b22c5129c11f5c762c5092d7c52e1ac3d536903 DIFF: https://github.com/llvm/llvm-project/commit/5b22c5129c11f5c762c5092d7c52e1ac3d536903.diff LOG: [clang] Add test for CWG952 P1787: // [[ https://wg21.link/cwg952 | CWG952 ]] is resolved by refining the definition of “naming class” per Richard’s suggestion in [[ https://lists.isocpp.org/core/2020/09/9963.php | “CWG1621 and [class.static/2”]].// Wording: - [class.static]/2 removed; - [class.access.base]/5 rephrased. Currently behavior is the following: unqualified names undergo //unqualified name lookup// [1], which perform //unqualified search// in immediate scope [2]. This scope is the scope the definition of //naming class// [3] refers to. `A::I` is not //accessible// when named in classes `C` and `D` per [3]. In particular, the last item regarding base class ([class.access.base]/5.4) is not applicable, because class `A` is not //accessible// in both classes `C` and `D` per [4]. References: 1. [[ https://eel.is/c++draft/basic.lookup#unqual-4.sentence-2 | basic.lookup.unqual/4 ]] 2. [[ https://eel.is/c++draft/basic.lookup#unqual-3 | basic.lookup.unqual/3 ]] 3. [[ https://eel.is/c++draft/class.access#base-5.sentence-4 | class.access.base/5 ]] 4. [[ https://eel.is/c++draft/class.access#base-4 | class.access.base/4 ]] Reviewed By: #clang-language-wg, erichkeane, aaron.ballman Differential Revision: https://reviews.llvm.org/D139326 Added: Modified: clang/test/CXX/drs/dr9xx.cpp clang/www/cxx_dr_status.html Removed: ################################################################################ diff --git a/clang/test/CXX/drs/dr9xx.cpp b/clang/test/CXX/drs/dr9xx.cpp index db40c8a01a8d3..039ba431e4a1f 100644 --- a/clang/test/CXX/drs/dr9xx.cpp +++ b/clang/test/CXX/drs/dr9xx.cpp @@ -1,11 +1,9 @@ // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors - -#if __cplusplus < 201103L -// expected-no-diagnostics -#endif +// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors namespace std { __extension__ typedef __SIZE_TYPE__ size_t; @@ -74,6 +72,34 @@ namespace dr948 { // dr948: 3.7 #endif } +namespace dr952 { // dr952: yes +struct A { + typedef int I; // #dr952-typedef-decl +}; +struct B : private A { // #dr952-inheritance +}; +struct C : B { + void f() { + I i1; // expected-error {{private member}} + // expected-note@#dr952-inheritance {{constrained by private inheritance}} + // expected-note@#dr952-typedef-decl {{declared here}} + } + I i2; // expected-error {{private member}} + // expected-note@#dr952-inheritance {{constrained by private inheritance}} + // expected-note@#dr952-typedef-decl {{declared here}} + struct D { + I i3; // expected-error {{private member}} + // expected-note@#dr952-inheritance {{constrained by private inheritance}} + // expected-note@#dr952-typedef-decl {{declared here}} + void g() { + I i4; // expected-error {{private member}} + // expected-note@#dr952-inheritance {{constrained by private inheritance}} + // expected-note@#dr952-typedef-decl {{declared here}} + } + }; +}; +} // namespace dr952 + namespace dr974 { // dr974: yes #if __cplusplus >= 201103L void test() { diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index 6fa7ead4138d5..73d238354bd5b 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -5520,7 +5520,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2> <td><a href="https://wg21.link/cwg952">952</a></td> <td>CD6</td> <td>Insufficient description of “naming class”</td> - <td class="none" align="center">Unknown</td> + <td class="full" align="center">Yes</td> </tr> <tr id="953"> <td><a href="https://wg21.link/cwg953">953</a></td> _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits