150
|
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime-has-weak -x objective-c -fobjc-arc -verify %s
|
|
2
|
|
3 void *memset(void *, int, __SIZE_TYPE__);
|
|
4 void bzero(void *, __SIZE_TYPE__);
|
|
5 void *memcpy(void *, const void *, __SIZE_TYPE__);
|
|
6 void *memmove(void *, const void *, __SIZE_TYPE__);
|
|
7
|
|
8 struct Trivial {
|
|
9 int f0;
|
|
10 volatile int f1;
|
|
11 };
|
|
12
|
|
13 struct NonTrivial0 {
|
|
14 int f0;
|
|
15 __weak id f1; // expected-note 2 {{non-trivial to default-initialize}} expected-note 2 {{non-trivial to copy}}
|
|
16 volatile int f2;
|
|
17 id f3[10]; // expected-note 2 {{non-trivial to default-initialize}} expected-note 2 {{non-trivial to copy}}
|
|
18 };
|
|
19
|
|
20 struct NonTrivial1 {
|
|
21 id f0; // expected-note 2 {{non-trivial to default-initialize}} expected-note 2 {{non-trivial to copy}}
|
|
22 int f1;
|
|
23 struct NonTrivial0 f2;
|
|
24 };
|
|
25
|
|
26 void testTrivial(struct Trivial *d, struct Trivial *s) {
|
|
27 memset(d, 0, sizeof(struct Trivial));
|
|
28 bzero(d, sizeof(struct Trivial));
|
|
29 memcpy(d, s, sizeof(struct Trivial));
|
|
30 memmove(d, s, sizeof(struct Trivial));
|
|
31 }
|
|
32
|
|
33 void testNonTrivial1(struct NonTrivial1 *d, struct NonTrivial1 *s) {
|
|
34 memset(d, 0, sizeof(struct NonTrivial1)); // expected-warning {{that is not trivial to primitive-default-initialize}} expected-note {{explicitly cast the pointer to silence}}
|
|
35 memset((void *)d, 0, sizeof(struct NonTrivial1));
|
|
36 bzero(d, sizeof(struct NonTrivial1)); // expected-warning {{that is not trivial to primitive-default-initialize}} expected-note {{explicitly cast the pointer to silence}}
|
|
37 memcpy(d, s, sizeof(struct NonTrivial1)); // expected-warning {{that is not trivial to primitive-copy}} expected-note {{explicitly cast the pointer to silence}}
|
|
38 memmove(d, s, sizeof(struct NonTrivial1)); // expected-warning {{that is not trivial to primitive-copy}} expected-note {{explicitly cast the pointer to silence}}
|
|
39 }
|