diff options
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaCXX/warn-memset-bad-sizeof.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp b/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp index 388e3627685..e0d28da3d58 100644 --- a/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp +++ b/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp @@ -104,6 +104,14 @@ void f(Mat m, const Foo& const_foo, char *buffer) { // Copy to raw buffer shouldn't warn either memcpy(&foo, &arr, sizeof(Foo)); memcpy(&arr, &foo, sizeof(Foo)); + + // Shouldn't warn, and shouldn't crash either. + memset(({ + if (0) {} + while (0) {} + for (;;) {} + &s; + }), 0, sizeof(s)); } namespace ns { |

