diff options
Diffstat (limited to 'clang/lib/Sema/SemaCast.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaCast.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp index 17d07c5..8edff24 100644 --- a/clang/lib/Sema/SemaCast.cpp +++ b/clang/lib/Sema/SemaCast.cpp @@ -2777,11 +2777,16 @@ void CastOperation::CheckCStyleCast() { // If the result cannot be represented in the integer type, the behavior // is undefined. The result need not be in the range of values of any // integer type. - unsigned Diag = Self.getLangOpts().MicrosoftExt - ? diag::ext_ms_pointer_to_int_cast - : SrcType->isVoidPointerType() - ? diag::warn_void_pointer_to_int_cast - : diag::warn_pointer_to_int_cast; + unsigned Diag; + if (Self.getLangOpts().MicrosoftExt) + Diag = diag::ext_ms_pointer_to_int_cast; + else if (SrcType->isVoidPointerType()) + Diag = DestType->isEnumeralType() ? diag::warn_void_pointer_to_enum_cast + : diag::warn_void_pointer_to_int_cast; + else if (DestType->isEnumeralType()) + Diag = diag::warn_pointer_to_enum_cast; + else + Diag = diag::warn_pointer_to_int_cast; Self.Diag(OpRange.getBegin(), Diag) << SrcType << DestType << OpRange; } } |
