From e9a2578db22faf4a0994f6f588c70407cfa3a4aa Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Sun, 12 Dec 2021 23:07:56 +0100 Subject: Fixed the source of the problem for the ptr_elems.c example bug. --- include/stc/ccommon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index e7775b58..70b2ff71 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -77,7 +77,7 @@ # define c_alloc(T) c_malloc(sizeof(T)) # define c_alloc_n(T, n) c_malloc(sizeof(T)*(n)) # define c_make(T) (T) -# define c_new(T, ...) memcpy(c_alloc(T), (T[]){__VA_ARGS__}, sizeof(T)) +# define c_new(T, ...) (T*)memcpy(c_alloc(T), (T[]){__VA_ARGS__}, sizeof(T)) #else # include # define c_alloc(T) static_cast(c_malloc(sizeof(T))) -- cgit v1.2.3