1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <cstring>
11
12 #include <cstring>
13 #include <type_traits>
14
15 #ifndef NULL
16 #error NULL not defined
17 #endif
18
main()19 int main()
20 {
21 std::size_t s = 0;
22 void* vp = 0;
23 const void* vpc = 0;
24 char* cp = 0;
25 const char* cpc = 0;
26 static_assert((std::is_same<decltype(std::memcpy(vp, vpc, s)), void*>::value), "");
27 static_assert((std::is_same<decltype(std::memmove(vp, vpc, s)), void*>::value), "");
28 static_assert((std::is_same<decltype(std::strcpy(cp, cpc)), char*>::value), "");
29 static_assert((std::is_same<decltype(std::strncpy(cp, cpc, s)), char*>::value), "");
30 static_assert((std::is_same<decltype(std::strcat(cp, cpc)), char*>::value), "");
31 static_assert((std::is_same<decltype(std::strncat(cp, cpc, s)), char*>::value), "");
32 static_assert((std::is_same<decltype(std::memcmp(vpc, vpc, s)), int>::value), "");
33 static_assert((std::is_same<decltype(std::strcmp(cpc, cpc)), int>::value), "");
34 static_assert((std::is_same<decltype(std::strncmp(cpc, cpc, s)), int>::value), "");
35 static_assert((std::is_same<decltype(std::strcoll(cpc, cpc)), int>::value), "");
36 static_assert((std::is_same<decltype(std::strxfrm(cp, cpc, s)), std::size_t>::value), "");
37 // static_assert((std::is_same<decltype(std::memchr(vpc, 0, s)), const void*>::value), "");
38 static_assert((std::is_same<decltype(std::memchr(vp, 0, s)), void*>::value), "");
39 // static_assert((std::is_same<decltype(std::strchr(cpc, 0)), const char*>::value), "");
40 static_assert((std::is_same<decltype(std::strchr(cp, 0)), char*>::value), "");
41 static_assert((std::is_same<decltype(std::strcspn(cpc, cpc)), std::size_t>::value), "");
42 // static_assert((std::is_same<decltype(std::strpbrk(cpc, cpc)), const char*>::value), "");
43 static_assert((std::is_same<decltype(std::strpbrk(cp, cpc)), char*>::value), "");
44 // static_assert((std::is_same<decltype(std::strrchr(cpc, 0)), const char*>::value), "");
45 static_assert((std::is_same<decltype(std::strrchr(cp, 0)), char*>::value), "");
46 static_assert((std::is_same<decltype(std::strspn(cpc, cpc)), std::size_t>::value), "");
47 // static_assert((std::is_same<decltype(std::strstr(cpc, cpc)), const char*>::value), "");
48 static_assert((std::is_same<decltype(std::strstr(cp, cpc)), char*>::value), "");
49 static_assert((std::is_same<decltype(std::strtok(cp, cpc)), char*>::value), "");
50 static_assert((std::is_same<decltype(std::memset(vp, 0, s)), void*>::value), "");
51 static_assert((std::is_same<decltype(std::strerror(0)), char*>::value), "");
52 static_assert((std::is_same<decltype(std::strlen(cpc)), std::size_t>::value), "");
53 }
54