From: Craig Topper Date: Thu, 15 Jun 2017 01:27:58 +0000 (+0000) Subject: [Basic] Use a static_assert instead of using the old array of size -1 trick. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ae017de6d07cd1fae4e475d5b64423551828f87;p=clang [Basic] Use a static_assert instead of using the old array of size -1 trick. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305439 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/AllDiagnostics.h b/include/clang/Basic/AllDiagnostics.h index 18a2b8a318..fc861a1952 100644 --- a/include/clang/Basic/AllDiagnostics.h +++ b/include/clang/Basic/AllDiagnostics.h @@ -28,7 +28,7 @@ namespace clang { template class StringSizerHelper { - char FIELD_TOO_SMALL[SizeOfStr <= FieldType(~0U) ? 1 : -1]; + static_assert(SizeOfStr <= FieldType(~0U), "Field too small!"); public: enum { Size = SizeOfStr }; };