[committed] testsuite: Expect -Wdeprecated warning in warn/Wstrict-aliasing-bogus-union-2.C for C++23

Message ID Y+IY7Er3m7bAxKCS@tucnak
State New
Headers
Series [committed] testsuite: Expect -Wdeprecated warning in warn/Wstrict-aliasing-bogus-union-2.C for C++23 |

Commit Message

Jakub Jelinek Feb. 7, 2023, 9:25 a.m. UTC
  Hi!

On Mon, Feb 06, 2023 at 02:26:01PM +0000, Jonathan Wakely via Gcc-patches wrote:
> With the recent change to deprecate std::aligned_storage and
> std::aligned_union we need to adjust some tests that now fail with
> -std=c++23.

The g++.dg/warn/Wstrict-aliasing-bogus-union-2.C test is also affected:
PASS: g++.dg/warn/Wstrict-aliasing-bogus-union-2.C  -std=gnu++2b  (test for bogus messages, line 12)
FAIL: g++.dg/warn/Wstrict-aliasing-bogus-union-2.C  -std=gnu++2b (test for excess errors)
Excess errors:
.../gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-union-2.C:8:8: warning: 'template<long unsigned int _Len, long unsigned int _Align> struct std::aligned_storage' is deprecated [-Wdeprecated-declarations]

The following patch adds dg-warning for it.

Tested on x86_64-linux -m32/-m64 with GXX_TESTSUITE_STDS=98,11,14,17,20,2b ,
committed to trunk as obvious.

2023-02-07  Jakub Jelinek  <jakub@redhat.com>

	* g++.dg/warn/Wstrict-aliasing-bogus-union-2.C: Expect
	-Wdeprecated warning for C++23.


	Jakub
  

Comments

Jonathan Wakely Feb. 7, 2023, 4:36 p.m. UTC | #1
On Tue, 7 Feb 2023 at 09:25, Jakub Jelinek <jakub@redhat.com> wrote:
>
> Hi!
>
> On Mon, Feb 06, 2023 at 02:26:01PM +0000, Jonathan Wakely via Gcc-patches wrote:
> > With the recent change to deprecate std::aligned_storage and
> > std::aligned_union we need to adjust some tests that now fail with
> > -std=c++23.
>
> The g++.dg/warn/Wstrict-aliasing-bogus-union-2.C test is also affected:
> PASS: g++.dg/warn/Wstrict-aliasing-bogus-union-2.C  -std=gnu++2b  (test for bogus messages, line 12)
> FAIL: g++.dg/warn/Wstrict-aliasing-bogus-union-2.C  -std=gnu++2b (test for excess errors)
> Excess errors:
> .../gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-union-2.C:8:8: warning: 'template<long unsigned int _Len, long unsigned int _Align> struct std::aligned_storage' is deprecated [-Wdeprecated-declarations]
>
> The following patch adds dg-warning for it.
>
> Tested on x86_64-linux -m32/-m64 with GXX_TESTSUITE_STDS=98,11,14,17,20,2b ,
> committed to trunk as obvious.

Oops, sorry about that - I must remember to check the g++ tests for
any header and deprecation changes.
  

Patch

--- gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-union-2.C.jj	2020-01-12 11:54:37.286400238 +0100
+++ gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-union-2.C	2023-02-07 10:21:47.616642483 +0100
@@ -5,7 +5,7 @@ 
 
 struct foo
 {
-  std::aligned_storage<sizeof(long), alignof(long)>::type raw;
+  std::aligned_storage<sizeof(long), alignof(long)>::type raw;	/* { dg-warning "deprecated" "" { target c++23 } } */
 
   long& cooked()
     {