From dbb258eb69cfb9729c9f2dd163c58d424b53ec81 Mon Sep 17 00:00:00 2001 From: Kyle Bayes Date: Tue, 7 May 2024 04:58:59 -0700 Subject: [PATCH] Fix compile-time `size_t` narrowing to `bool`. PiperOrigin-RevId: 631381101 Change-Id: I5188c352354573476decb8ae6bc007faf623a884 --- src/user/user_api.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/user/user_api.cc b/src/user/user_api.cc index abc6e23c..158e35f1 100644 --- a/src/user/user_api.cc +++ b/src/user/user_api.cc @@ -703,7 +703,7 @@ void mj_setCacheSize(mjCache cache, std::size_t size) { mjCache mj_globalCache() { // mjCCache is not trivially destructible and so the global cache needs to // allocated on the heap - if constexpr (kGlobalCacheSize) { + if constexpr (kGlobalCacheSize != 0) { static mjCCache* cache = new(std::nothrow) mjCCache(kGlobalCacheSize); return (mjCache) cache; } else {