From 381d1d0120e4dfab3a714f44354e868a80dbaa25 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 3 Dec 2020 10:02:02 +0100 Subject: [PATCH] testsuite: Add testcase for already fixed PR [PR98104] This testcase got broken with r11-3826 and got fixed with r11-5628. 2020-12-03 Jakub Jelinek PR c++/98104 * g++.dg/warn/pr98104.C: New test. --- gcc/testsuite/g++.dg/warn/pr98104.C | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/pr98104.C diff --git a/gcc/testsuite/g++.dg/warn/pr98104.C b/gcc/testsuite/g++.dg/warn/pr98104.C new file mode 100644 index 00000000000..6ca617befe2 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/pr98104.C @@ -0,0 +1,20 @@ +// PR c++/98104 + +#include + +struct B +{ + B (); + int *a; + char b; +}; + +struct D : public B {}; +void bar (B *); + +void +foo () +{ + D d; + bar (::new (static_cast(&d)) B); // { dg-bogus "placement new constructing an object of type 'B' and size '\[0-9]*' in a region of type 'B' and size '\[0-9]*'" } +} -- 2.30.2