testsuite: Add testcase for already fixed PR [PR98104]
authorJakub Jelinek <jakub@redhat.com>
Thu, 3 Dec 2020 09:02:02 +0000 (10:02 +0100)
committerJakub Jelinek <jakub@redhat.com>
Thu, 3 Dec 2020 09:04:54 +0000 (10:04 +0100)
This testcase got broken with r11-3826 and got fixed with r11-5628.

2020-12-03  Jakub Jelinek  <jakub@redhat.com>

PR c++/98104
* g++.dg/warn/pr98104.C: New test.

gcc/testsuite/g++.dg/warn/pr98104.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/warn/pr98104.C b/gcc/testsuite/g++.dg/warn/pr98104.C
new file mode 100644 (file)
index 0000000..6ca617b
--- /dev/null
@@ -0,0 +1,20 @@
+// PR c++/98104
+
+#include <new>
+
+struct B
+{
+  B ();
+  int *a;
+  char b;
+};
+
+struct D : public B {};
+void bar (B *);
+
+void
+foo ()
+{
+  D d;
+  bar (::new (static_cast<B*>(&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]*'" }
+}