From 525761fd7dc98e1b13920a5fe60da63cdd80f0cc Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 24 May 2023 08:48:42 -0700 Subject: [PATCH] static_assert is a keyword in C23. Test: treehugger Change-Id: I4eba529475b6255bef1af558f54c373aad8737d0 --- libc/include/assert.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libc/include/assert.h b/libc/include/assert.h index 8db970b37..750d12e9a 100644 --- a/libc/include/assert.h +++ b/libc/include/assert.h @@ -64,7 +64,8 @@ # endif #endif -#if !defined(__cplusplus) && __STDC_VERSION__ >= 201112L +/* `static_assert` is a keyword in C++11 and C23; C11 had `_Static_assert` instead. */ +#if !defined(__cplusplus) && (__STDC_VERSION__ >= 201112L && __STDC_VERSION__ < 202311L) # undef static_assert # define static_assert _Static_assert #endif