[PR c++/84702] ICE with default tmpl arg of overload set
[official-gcc.git] / gcc / testsuite / g++.dg / ext / builtin-object-size3.C
blob1e158cd6d012e1c59c8f0cbba2243d09b6ebd627
1 // { dg-do compile }
2 // { dg-options "-O2" }
4 void baz (int *, int *);
6 #define MEMCPY(d,s,l) __builtin___memcpy_chk (d, s, l, __builtin_object_size (d, 0)) // { dg-warning "writing" }
8 void
9 foo ()
11   int *p = new int;
12   int *q = new int[4];
13   MEMCPY (p, "abcdefghijklmnopqrstuvwxyz", sizeof (int));
14   MEMCPY (q, "abcdefghijklmnopqrstuvwxyz", 4 * sizeof (int));
15   baz (p, q);
18 void
19 bar ()
21   int *p = new int;
22   int *q = new int[4];
23   MEMCPY (p, "abcdefghijklmnopqrstuvwxyz", sizeof (int) + 1); // { dg-message "in expansion of macro" }
24   MEMCPY (q, "abcdefghijklmnopqrstuvwxyz", 4 * sizeof (int) + 1); // { dg-message "in expansion of macro" }
25   baz (p, q);