// RUN: %clang_cc1 -fsyntax-only -verify %s
#defineNULL((char*)0)#if __has_builtin(__builtin_memset_inline)
#warningdefinedasexpected// expected-warning@-1 {{defined as expected}}
#endifvoidtest_memset_inline_invalid_arg_types(){__builtin_memset_inline(1,2,3);// expected-error {{cannot initialize a parameter of type 'void *' with an rvalue of type 'int'}}
}voidtest_memset_inline_null_dst(void*ptr){__builtin_memset_inline(NULL,1,4);// expected-warning {{null passed to a callee that requires a non-null argument}}
}voidtest_memset_inline_null_buffer_is_ok_if_size_is_zero(void*ptr,charvalue){__builtin_memset_inline(NULL, value,/*size */0);}voidtest_memset_inline_non_constant_size(void*dst,charvalue,unsignedsize){__builtin_memset_inline(dst, value, size);// expected-error {{argument to '__builtin_memset_inline' must be a constant integer}}
}template<unsigned size>voidtest_memset_inline_template(void*dst,charvalue){// we do not try to evaluate size in non intantiated templates.
__builtin_memset_inline(dst, value, size);}voidtest_memset_inline_implicit_conversion(void*ptr,charvalue){char a[5];__builtin_memset_inline(a, value,5);}voidtest_memset_inline_num_args(void*dst,charvalue){__builtin_memset_inline();// expected-error {{too few arguments to function call}}
__builtin_memset_inline(dst, value,4,NULL);// expected-error {{too many arguments to function call}}
}