summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/Wclass-memaccess-5.C
blob: d0fffead56d3afaf5f9c2ffe2ed9917713eb23a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* PR c++/92001 - missing -Wclass-memaccess with array as first argument
   to memset
   { dg-do compile }
   { dg-options "-Wall" } */

extern "C" void* memset (void*, int, __SIZE_TYPE__);

struct S { S (); };

void test_array_access (S *p, S (*pa)[2], S (&r)[3])
{
  S a[1];
  memset (a, 0, sizeof a);        // { dg-warning "-Wclass-memaccess" }

  memset (*pa, 0, sizeof *pa);    // { dg-warning "-Wclass-memaccess" }

  memset (r, 0, sizeof r);        // { dg-warning "-Wclass-memaccess" }
}