summaryrefslogtreecommitdiffstats
path: root/source/core/slang-string.h
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2023-04-27 12:36:59 +0800
committerGitHub <noreply@github.com>2023-04-26 21:36:59 -0700
commit3acbe8145c60f4d1e7a180b4602a94269a489df5 (patch)
tree8031e7ca897260ac3ab6d2a920864f3114bc8668 /source/core/slang-string.h
parenta3da31c189a1cc9bdf85a42ac359b8c2777f3550 (diff)
Fix most of the disabled warnings on gcc/clang (#2839)
Diffstat (limited to 'source/core/slang-string.h')
-rw-r--r--source/core/slang-string.h4
1 files changed, 4 insertions, 0 deletions
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];
}