diff --git a/meson.build b/meson.build index 68fb91ee..9acc1f49 100644 --- a/meson.build +++ b/meson.build @@ -134,7 +134,9 @@ if cc.has_header('xlocale.h') endif code = ''' -void func() { auto foo = "test"; } +#include + +void func() { auto foo = gmtime(NULL); foo->tm_sec = 0; } ''' if cc.compiles(code, name: 'has C23 auto keyword') config_h.set('HAVE_C23_AUTO', '1') diff --git a/test/test-utils.c b/test/test-utils.c index ca806990..0c32ad4f 100644 --- a/test/test-utils.c +++ b/test/test-utils.c @@ -51,6 +51,15 @@ #define TEST_VERSIONSORT #include "libinput-versionsort.h" +START_TEST(auto_test) +{ + /* This one is just a compile test */ + auto tv = us2tv(0); + tv.tv_sec = 0; + litest_assert_int_eq(tv.tv_sec, 0); +} +END_TEST + START_TEST(mkdir_p_test) { const char *testdir = "/tmp/litest_mkdir_test"; @@ -2258,6 +2267,7 @@ int main(void) litest_runner_add_test(runner, &tdesc); \ } while(0) + ADD_TEST(auto_test); ADD_TEST(mkdir_p_test); ADD_TEST(array_for_each);