From a96fc7ab00e84f85bf1f85c5c9264ad3a1bd280d Mon Sep 17 00:00:00 2001 From: Pete Cooper Date: Tue, 9 Jun 2015 20:58:03 +0000 Subject: [PATCH] Use AlignOf traits to enable static_assert. This is better than runtime asserts. Thanks to David Blaikie for the help here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239431 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCSymbol.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/MC/MCSymbol.cpp b/lib/MC/MCSymbol.cpp index f0f35f7b29e..836d28294f5 100644 --- a/lib/MC/MCSymbol.cpp +++ b/lib/MC/MCSymbol.cpp @@ -28,9 +28,9 @@ void *MCSymbol::operator new(size_t s, const StringMapEntry *Name, // For safety, ensure that the alignment of a pointer is enough for an // MCSymbol. This also ensures we don't need padding between the name and // symbol. - // FIXME: Use static_assert when constexpr is supported. - assert(alignOf() <= alignOf() && - "Bad alignment of MCSymbol"); + static_assert(AlignOf::Alignment <= + AlignOf::Alignment, + "Bad alignment of MCSymbol"); void *Storage = Ctx.allocate(Size, alignOf()); NameEntryStorageTy *Start = static_cast(Storage); NameEntryStorageTy *End = Start + (Name ? 1 : 0); -- 2.34.1