[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Sema / builtin-memcpy.c
blob2a55e78034a02fef44c50c70ec8cfad75c8f364a
1 // RUN: %clang_cc1 %s -triple x86_64-unknown-linux -fsyntax-only -verify=c
2 // RUN: %clang_cc1 -x c++ %s -triple x86_64-unknown-linux -fsyntax-only -verify=cxx
4 // cxx-no-diagnostics
7 /// Zero-sized structs should not crash.
8 int b() {
9 struct { } a[10];
10 __builtin_memcpy(&a[2], a, 2); // c-warning {{buffer has size 0, but size argument is 2}}
11 return 0;
14 #ifdef __cplusplus
15 // FIXME: This is UB and GCC correctly diagnoses it. Clang should do the same.
16 constexpr int b2() {
17 struct { } a[10];
18 __builtin_memcpy(&a[2], a, 2);
19 return 0;
21 static_assert(b2() == 0, "");
22 #endif