diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp
index c76d94e7d800267f39bbd950c9918d31e5db6cce..460e7722c10272227768689b1058e872c42e9c31 100644
--- a/lib/Sema/DeclSpec.cpp
+++ b/lib/Sema/DeclSpec.cpp
@@ -1112,7 +1112,7 @@ void DeclSpec::Finish(Sema &S, const PrintingPolicy &Policy) {
   }
 
   // Validate the width of the type.
-  switch (TypeSpecWidth) {
+  switch (static_cast<TypeSpecifierWidth>(TypeSpecWidth)) {
   case TSW_unspecified: break;
   case TSW_short:    // short int
   case TSW_longlong: // long long int