From: Daniel Jasper Date: Wed, 3 May 2017 07:48:27 +0000 (+0000) Subject: Silences gcc's -Wnarrowing. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7992b2b91e973c0f58ba25f101df154d18f842e7;p=clang Silences gcc's -Wnarrowing. I think this is a false positive in GCC's warning, but nonetheless, we should try to be warning-free. Smaller reproducer (reproduces with GCC 6.3): https://godbolt.org/g/cJuO2z git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302003 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 69cdc37665..8e4b217a44 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -2872,8 +2872,9 @@ void ASTWriter::WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag, [](const DiagnosticsEngine::DiagState *DS) -> unsigned { unsigned Result = (unsigned)DS->ExtBehavior; for (unsigned Val : - {DS->IgnoreAllWarnings, DS->EnableAllWarnings, DS->WarningsAsErrors, - DS->ErrorsAsFatal, DS->SuppressSystemWarnings}) + {(unsigned)DS->IgnoreAllWarnings, (unsigned)DS->EnableAllWarnings, + (unsigned)DS->WarningsAsErrors, (unsigned)DS->ErrorsAsFatal, + (unsigned)DS->SuppressSystemWarnings}) Result = (Result << 1) | Val; return Result; };