Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wclass-memaccess-5.C

raw
1 /* PR c++/92001 - missing -Wclass-memaccess with array as first argument
2 to memset
3 { dg-do compile }
4 { dg-options "-Wall" } */
5
6 extern "C" void* memset (void*, int, __SIZE_TYPE__);
7
8 struct S { S (); };
9
10 void test_array_access (S *p, S (*pa)[2], S (&r)[3])
11 {
12 S a[1];
13 memset (a, 0, sizeof a); // { dg-warning "-Wclass-memaccess" }
14
15 memset (*pa, 0, sizeof *pa); // { dg-warning "-Wclass-memaccess" }
16
17 memset (r, 0, sizeof r); // { dg-warning "-Wclass-memaccess" }
18 }