[clang] 66ac53f - [clang][cli] Fix gcc "enumeral and non-enumeral type in conditional expression" warning (NFC)

Yang Fan via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 9 19:18:07 PST 2021


Author: Yang Fan
Date: 2021-02-10T11:15:39+08:00
New Revision: 66ac53fe319be932d31ef96bdca34ad2b897cf04

URL: https://github.com/llvm/llvm-project/commit/66ac53fe319be932d31ef96bdca34ad2b897cf04
DIFF: https://github.com/llvm/llvm-project/commit/66ac53fe319be932d31ef96bdca34ad2b897cf04.diff

LOG: [clang][cli] Fix gcc "enumeral and non-enumeral type in conditional expression" warning (NFC)

Added: 
    

Modified: 
    clang/lib/Frontend/CompilerInvocation.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 928009ebf2f4..d06b2c9e677f 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -386,7 +386,7 @@ template <typename T> static T extractForwardValue(T KeyPath) {
 
 template <typename T, typename U, U Value>
 static T extractMaskValue(T KeyPath) {
-  return ((KeyPath & Value) == Value) ? Value : T();
+  return ((KeyPath & Value) == Value) ? static_cast<T>(Value) : T();
 }
 
 #define PARSE_OPTION_WITH_MARSHALLING(ARGS, DIAGS, SUCCESS, ID, FLAGS, PARAM,  \


        


More information about the cfe-commits mailing list