[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / SemaCXX / address-packed-member-memops.cpp
blob6614626ae65cb41d8c045bc8445ebdf8d80e1ee3
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // expected-no-diagnostics
4 struct B {
5 int x, y, z, w;
6 } b;
8 struct __attribute__((packed)) A {
9 struct B b;
10 } a;
12 typedef __typeof__(sizeof(int)) size_t;
14 extern "C" {
15 void *memcpy(void *dest, const void *src, size_t n);
16 int memcmp(const void *s1, const void *s2, size_t n);
17 void *memmove(void *dest, const void *src, size_t n);
18 void *memset(void *s, int c, size_t n);
21 int x;
23 void foo() {
24 memcpy(&a.b, &b, sizeof(b));
25 memmove(&a.b, &b, sizeof(b));
26 memset(&a.b, 0, sizeof(b));
27 x = memcmp(&a.b, &b, sizeof(b));