From c0b8743f35efccc52d97288b09f59089386c83f8 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Thu, 17 Apr 2014 06:17:20 +0000 Subject: [PATCH] MC: rework static_assert to be MSVC compatible Visual Studio does not permit referencing a structure member as a static field for sizeof calculations. Resort to a pointer cast which is compatible across Visual Studio and other compilers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206445 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/WinCOFFObjectWriter.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/MC/WinCOFFObjectWriter.cpp b/lib/MC/WinCOFFObjectWriter.cpp index 8e5377980d7..cb02fdedec3 100644 --- a/lib/MC/WinCOFFObjectWriter.cpp +++ b/lib/MC/WinCOFFObjectWriter.cpp @@ -632,10 +632,8 @@ void WinCOFFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm, const MCAsmLayout &Layout) { // "Define" each section & symbol. This creates section & symbol // entries in the staging area. - // FIXME: this used to be - // sizeof(COFF::AuxiliaryFile::FileName) == COFF::SymbolSize - // but VS2013 can't compile that. - static_assert(sizeof(COFF::AuxiliaryFile) == COFF::SymbolSize, + + static_assert(sizeof(((COFF::AuxiliaryFile *)0)->FileName) == COFF::SymbolSize, "size mismatch for COFF::AuxiliaryFile::FileName"); for (auto FI = Asm.file_names_begin(), FE = Asm.file_names_end(); FI != FE; ++FI) {