https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/87909
>From 222f444f91d477bbc1ab2657a7f820740031f765 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov <serebrennikov.vladis...@gmail.com> Date: Sun, 7 Apr 2024 10:52:10 +0300 Subject: [PATCH 1/2] [clang] Add tests for some CWG 5xx issues --- clang/test/CXX/drs/dr15xx.cpp | 2 +- clang/test/CXX/drs/dr19xx.cpp | 2 +- clang/test/CXX/drs/dr3xx.cpp | 12 ++++++++++++ clang/test/CXX/drs/dr5xx.cpp | 37 +++++++++++++++++++++++++++++++++++ clang/www/cxx_dr_status.html | 16 +++++++-------- 5 files changed, 59 insertions(+), 10 deletions(-) diff --git a/clang/test/CXX/drs/dr15xx.cpp b/clang/test/CXX/drs/dr15xx.cpp index 195c0fa610d579..6e3ad41c748fb1 100644 --- a/clang/test/CXX/drs/dr15xx.cpp +++ b/clang/test/CXX/drs/dr15xx.cpp @@ -555,7 +555,7 @@ auto DR1579_lambda_invalid = []() -> GenericMoveOnly<char> { #endif } // end namespace dr1579 -namespace dr1584 { +namespace dr1584 { // dr1584: 7 drafting 2015-05 #if __cplusplus >= 201103L // Deducing function types from cv-qualified types template<typename T> void f(const T *); // #dr1584-f diff --git a/clang/test/CXX/drs/dr19xx.cpp b/clang/test/CXX/drs/dr19xx.cpp index 716b1476831ed9..f8c1581f08540e 100644 --- a/clang/test/CXX/drs/dr19xx.cpp +++ b/clang/test/CXX/drs/dr19xx.cpp @@ -34,7 +34,7 @@ namespace dr1902 { // dr1902: 3.7 #endif } -namespace dr1903 { +namespace dr1903 { // dr1903: 2.7 namespace A { struct a {}; int a; diff --git a/clang/test/CXX/drs/dr3xx.cpp b/clang/test/CXX/drs/dr3xx.cpp index 483ebf7a08aadb..6165835e2c183d 100644 --- a/clang/test/CXX/drs/dr3xx.cpp +++ b/clang/test/CXX/drs/dr3xx.cpp @@ -1568,6 +1568,18 @@ namespace dr391 { // dr391: 2.8 c++11 } // dr392 is in dr392.cpp + +namespace dr393 { // dr393: 2.7 + +template <typename T> +struct S {}; + +void f1(S<int (*)[]>); +void f2(S<int (&)[]>); +void g(int(*S<int>::*)[]); + +} // namespace dr393 + // dr394: na namespace dr395 { // dr395: 3.0 diff --git a/clang/test/CXX/drs/dr5xx.cpp b/clang/test/CXX/drs/dr5xx.cpp index 426b368b390ae6..981b9d1afca970 100644 --- a/clang/test/CXX/drs/dr5xx.cpp +++ b/clang/test/CXX/drs/dr5xx.cpp @@ -18,6 +18,10 @@ namespace std { void *operator new(size_t, std::align_val_t); // #dr5xx-global-operator-new-aligned #endif +namespace std { + struct type_info; +} + namespace dr500 { // dr500: dup 372 class D; class A { @@ -265,6 +269,18 @@ namespace dr527 { // dr527: na int ax = a.x, bx = b.x, cx = c.x, dx = d.x, ex = E::e->x, fx = F::f->x; } +namespace dr528 { // dr528: 2.7 + +struct S; // #dr528-S + +void f() { + typeid(S); + // expected-error@-1 {{'typeid' of incomplete type 'S'}} + // expected-note@#dr528-S {{forward declaration of 'dr528::S'}} +} + +} // namespace dr528 + namespace dr530 { // dr530: yes template<int*> struct S { enum { N = 1 }; }; template<void(*)()> struct T { enum { N = 1 }; }; @@ -618,6 +634,8 @@ namespace dr548 { // dr548: dup 482 template void dr548::f<int>(); } +// dr550: dup 393 + namespace dr551 { // dr551: yes c++11 // FIXME: This obviously should apply in C++98 mode too. template<typename T> void f() {} @@ -641,6 +659,7 @@ namespace dr552 { // dr552: yes X<Y, 0> x; } +// dr553: 2.7 struct dr553_class { friend void *operator new(size_t, dr553_class); }; @@ -661,6 +680,10 @@ namespace dr553 { } // dr554: na + +// dr555: na +// NB: name lookup cases that issue briefly touches are covered in our test for CWG466 + // dr556: na namespace dr557 { // dr557: 3.1 @@ -689,6 +712,20 @@ namespace dr558 { // dr558: 2.9 template<typename> struct dr559 { typedef int T; dr559::T u; }; // dr559: yes +namespace dr560 { // dr560: 16 + +template <class T> +struct Outer { + struct Inner { + Inner* self(); + }; +}; +template <class T> +Outer<T>::Inner* Outer<T>::Inner::self() { return this; } +// cxx98-17-error@-1 {{missing 'typename' prior to dependent type name Outer<T>::Inner; implicit 'typename' is a C++20 extension}} + +} // namespace dr560 + namespace dr561 { // dr561: yes template<typename T> void f(int); template<typename T> void g(T t) { diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index a4c133c13c493f..15318bab81359b 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -2398,7 +2398,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2> <td><a href="https://cplusplus.github.io/CWG/issues/393.html">393</a></td> <td>CD4</td> <td>Pointer to array of unknown bound in template argument list in parameter</td> - <td class="unknown" align="center">Unknown</td> + <td class="full" align="center">Clang 2.7</td> </tr> <tr id="394"> <td><a href="https://cplusplus.github.io/CWG/issues/394.html">394</a></td> @@ -3208,7 +3208,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2> <td><a href="https://cplusplus.github.io/CWG/issues/528.html">528</a></td> <td>NAD</td> <td>Why are incomplete class types not allowed with <TT>typeid</TT>?</td> - <td class="unknown" align="center">Unknown</td> + <td class="full" align="center">Clang 2.7</td> </tr> <tr class="open" id="529"> <td><a href="https://cplusplus.github.io/CWG/issues/529.html">529</a></td> @@ -3342,7 +3342,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2> <td><a href="https://cplusplus.github.io/CWG/issues/550.html">550</a></td> <td>dup</td> <td>Pointer to array of unknown bound in parameter declarations</td> - <td class="unknown" align="center">Unknown</td> + <td class="full" align="center">Duplicate of <a href="#393">393</a></td> </tr> <tr id="551"> <td><a href="https://cplusplus.github.io/CWG/issues/551.html">551</a></td> @@ -3360,7 +3360,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2> <td><a href="https://cplusplus.github.io/CWG/issues/553.html">553</a></td> <td>NAD</td> <td>Problems with friend allocation and deallocation functions</td> - <td class="unknown" align="center">Unknown</td> + <td class="full" align="center">Clang 2.7</td> </tr> <tr id="554"> <td><a href="https://cplusplus.github.io/CWG/issues/554.html">554</a></td> @@ -3372,7 +3372,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2> <td><a href="https://cplusplus.github.io/CWG/issues/555.html">555</a></td> <td>CD5</td> <td>Pseudo-destructor name lookup</td> - <td class="unknown" align="center">Unknown</td> + <td class="na" align="center">N/A</td> </tr> <tr id="556"> <td><a href="https://cplusplus.github.io/CWG/issues/556.html">556</a></td> @@ -3402,7 +3402,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2> <td><a href="https://cplusplus.github.io/CWG/issues/560.html">560</a></td> <td>NAD</td> <td>Use of the <TT>typename</TT> keyword in return types</td> - <td class="unknown" align="center">Unknown</td> + <td class="full" align="center">Clang 16</td> </tr> <tr id="561"> <td><a href="https://cplusplus.github.io/CWG/issues/561.html">561</a></td> @@ -9312,7 +9312,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2> <td><a href="https://cplusplus.github.io/CWG/issues/1584.html">1584</a></td> <td>drafting</td> <td>Deducing function types from cv-qualified types</td> - <td align="center">Not resolved</td> + <td title="Clang 7 implements 2015-05 resolution" align="center">Not Resolved*</td> </tr> <tr id="1585"> <td><a href="https://cplusplus.github.io/CWG/issues/1585.html">1585</a></td> @@ -11226,7 +11226,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2> <td><a href="https://cplusplus.github.io/CWG/issues/1903.html">1903</a></td> <td>CD4</td> <td>What declarations are introduced by a non-member <I>using-declaration</I>?</td> - <td class="unknown" align="center">Unknown</td> + <td class="full" align="center">Clang 2.7</td> </tr> <tr id="1904"> <td><a href="https://cplusplus.github.io/CWG/issues/1904.html">1904</a></td> >From 597d01431e43963d4181746ad207aaad13c39f20 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov <serebrennikov.vladis...@gmail.com> Date: Mon, 8 Apr 2024 12:18:12 +0300 Subject: [PATCH 2/2] Add more examples for CWG393 --- clang/test/CXX/drs/dr3xx.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/clang/test/CXX/drs/dr3xx.cpp b/clang/test/CXX/drs/dr3xx.cpp index 6165835e2c183d..d5cfebccf8134b 100644 --- a/clang/test/CXX/drs/dr3xx.cpp +++ b/clang/test/CXX/drs/dr3xx.cpp @@ -1570,7 +1570,6 @@ namespace dr391 { // dr391: 2.8 c++11 // dr392 is in dr392.cpp namespace dr393 { // dr393: 2.7 - template <typename T> struct S {}; @@ -1578,6 +1577,14 @@ void f1(S<int (*)[]>); void f2(S<int (&)[]>); void g(int(*S<int>::*)[]); +template<typename T> +void sp_assert_convertible( T* ) {} + +template<typename T, typename U> +void h() { + T (*p) [] = (U(*)[])0; + sp_assert_convertible<T[]>( (U(*)[])0 ); +} } // namespace dr393 // dr394: na _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits