From 3acbe8145c60f4d1e7a180b4602a94269a489df5 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Thu, 27 Apr 2023 12:36:59 +0800 Subject: Fix most of the disabled warnings on gcc/clang (#2839) --- source/core/slang-string.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/core/slang-string.h') diff --git a/source/core/slang-string.h b/source/core/slang-string.h index 4c78cc32e..429a60c46 100644 --- a/source/core/slang-string.h +++ b/source/core/slang-string.h @@ -583,6 +583,10 @@ namespace Slang char operator[](Index id) const { SLANG_ASSERT(id >= 0 && id < getLength()); + // Silence a pedantic warning on GCC +#if __GNUC__ + if(id < 0) __builtin_unreachable(); +#endif return begin()[id]; } -- cgit v1.2.3