1// RUN: %clang %s -o %t && %run %t 2>&1
2
3#include <assert.h>
4#include <stdlib.h>
5#include <wchar.h>
6
7int main(int argc, char **argv) {
8 wchar_t *buff = wcsdup(s: L"foo");
9 assert(buff[0] == L'f');
10 assert(buff[1] == L'o');
11 assert(buff[2] == L'o');
12 assert(buff[3] == L'\0');
13 free(ptr: buff);
14 return 0;
15}
16

source code of compiler-rt/test/sanitizer_common/TestCases/Posix/wcsdup.c