1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix -verify %s 2 3 // expected-no-diagnostics 4 5 // Test functions that are called "memcpy" but aren't the memcpy 6 // we're looking for. Unfortunately, this test cannot be put into 7 // a namespace. The out-of-class weird memcpy needs to be recognized 8 // as a normal C function for the test to make sense. 9 typedef __typeof(sizeof(int)) size_t; 10 void *memcpy(void *, const void *, size_t); 11 12 struct S { 13 static S s1, s2; 14 15 // A weird overload within the class that accepts a structure reference 16 // instead of a pointer. 17 void memcpy(void *, const S &, size_t); 18 void test_in_class_weird_memcpy() { 19 memcpy(this, s2, 1); // no-crash 20 } 21 }; 22 23 // A similarly weird overload outside of the class. 24 void *memcpy(void *, const S &, size_t); 25 26 void test_out_of_class_weird_memcpy() { 27 memcpy(&S::s1, S::s2, 1); // no-crash 28 } 29