cxx/test/depr/depr.c.headers/string_h.pass.cpp
Howard Hinnant b64f8b07c1 license change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119395 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 22:09:02 +00:00

49 lines
2.3 KiB
C++

//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <string.h>
#include <string.h>
#include <type_traits>
#ifndef NULL
#error NULL not defined
#endif
int main()
{
size_t s = 0;
void* vp = 0;
const void* vpc = 0;
char* cp = 0;
const char* cpc = 0;
static_assert((std::is_same<decltype(memcpy(vp, vpc, s)), void*>::value), "");
static_assert((std::is_same<decltype(memmove(vp, vpc, s)), void*>::value), "");
static_assert((std::is_same<decltype(strcpy(cp, cpc)), char*>::value), "");
static_assert((std::is_same<decltype(strncpy(cp, cpc, s)), char*>::value), "");
static_assert((std::is_same<decltype(strcat(cp, cpc)), char*>::value), "");
static_assert((std::is_same<decltype(strncat(cp, cpc, s)), char*>::value), "");
static_assert((std::is_same<decltype(memcmp(vpc, vpc, s)), int>::value), "");
static_assert((std::is_same<decltype(strcmp(cpc, cpc)), int>::value), "");
static_assert((std::is_same<decltype(strncmp(cpc, cpc, s)), int>::value), "");
static_assert((std::is_same<decltype(strcoll(cpc, cpc)), int>::value), "");
static_assert((std::is_same<decltype(strxfrm(cp, cpc, s)), size_t>::value), "");
static_assert((std::is_same<decltype(memchr(vp, 0, s)), void*>::value), "");
static_assert((std::is_same<decltype(strchr(cp, 0)), char*>::value), "");
static_assert((std::is_same<decltype(strcspn(cpc, cpc)), size_t>::value), "");
static_assert((std::is_same<decltype(strpbrk(cp, cpc)), char*>::value), "");
static_assert((std::is_same<decltype(strrchr(cp, 0)), char*>::value), "");
static_assert((std::is_same<decltype(strspn(cpc, cpc)), size_t>::value), "");
static_assert((std::is_same<decltype(strstr(cp, cpc)), char*>::value), "");
static_assert((std::is_same<decltype(strtok(cp, cpc)), char*>::value), "");
static_assert((std::is_same<decltype(memset(vp, 0, s)), void*>::value), "");
static_assert((std::is_same<decltype(strerror(0)), char*>::value), "");
static_assert((std::is_same<decltype(strlen(cpc)), size_t>::value), "");
}