AnyInvocable: Use enums instead of ints in initialization overload set

This trick was introduced to work around a compiler bug in msvc 2017, which abseil doesn't support anymore: https://github.com/google/oss-policies-info/blob/3aa4b98f497fdfac983b8de78cf6bd693cb0cf4f/foundational-cxx-support-matrix.md

PiperOrigin-RevId: 543477428
Change-Id: I332c1b359b75811536ce900d3166979ac3c196a3
diff --git a/absl/functional/internal/any_invocable.h b/absl/functional/internal/any_invocable.h
index a52fa87..f096bb0 100644
--- a/absl/functional/internal/any_invocable.h
+++ b/absl/functional/internal/any_invocable.h
@@ -440,11 +440,11 @@
 
   CoreImpl() noexcept : manager_(EmptyManager), invoker_(nullptr) {}
 
-  enum class TargetType : int {
-    kPointer = 0,
-    kCompatibleAnyInvocable = 1,
-    kIncompatibleAnyInvocable = 2,
-    kOther = 3,
+  enum class TargetType {
+    kPointer,
+    kCompatibleAnyInvocable,
+    kIncompatibleAnyInvocable,
+    kOther,
   };
 
   // Note: QualDecayedTRef here includes the cv-ref qualifiers associated with
@@ -466,8 +466,7 @@
     // NOTE: We only use integers instead of enums as template parameters in
     // order to work around a bug on C++14 under MSVC 2017.
     // See b/236131881.
-    Initialize<static_cast<int>(kTargetType), QualDecayedTRef>(
-        std::forward<F>(f));
+    Initialize<kTargetType, QualDecayedTRef>(std::forward<F>(f));
   }
 
   // Note: QualTRef here includes the cv-ref qualifiers associated with the
@@ -518,8 +517,8 @@
     invoker_ = nullptr;
   }
 
-  template <int target_type, class QualDecayedTRef, class F,
-            absl::enable_if_t<target_type == 0, int> = 0>
+  template <TargetType target_type, class QualDecayedTRef, class F,
+            absl::enable_if_t<target_type == TargetType::kPointer, int> = 0>
   void Initialize(F&& f) {
 // This condition handles types that decay into pointers, which includes
 // function references. Since function references cannot be null, GCC warns
@@ -543,8 +542,9 @@
     InitializeStorage<QualDecayedTRef>(std::forward<F>(f));
   }
 
-  template <int target_type, class QualDecayedTRef, class F,
-            absl::enable_if_t<target_type == 1, int> = 0>
+  template <TargetType target_type, class QualDecayedTRef, class F,
+            absl::enable_if_t<
+                target_type == TargetType::kCompatibleAnyInvocable, int> = 0>
   void Initialize(F&& f) {
     // In this case we can "steal the guts" of the other AnyInvocable.
     f.manager_(FunctionToCall::relocate_from_to, &f.state_, &state_);
@@ -555,8 +555,9 @@
     f.invoker_ = nullptr;
   }
 
-  template <int target_type, class QualDecayedTRef, class F,
-            absl::enable_if_t<target_type == 2, int> = 0>
+  template <TargetType target_type, class QualDecayedTRef, class F,
+            absl::enable_if_t<
+                target_type == TargetType::kIncompatibleAnyInvocable, int> = 0>
   void Initialize(F&& f) {
     if (f.HasValue()) {
       InitializeStorage<QualDecayedTRef>(std::forward<F>(f));
@@ -566,8 +567,8 @@
     }
   }
 
-  template <int target_type, class QualDecayedTRef, class F,
-            typename = absl::enable_if_t<target_type == 3>>
+  template <TargetType target_type, class QualDecayedTRef, class F,
+            typename = absl::enable_if_t<target_type == TargetType::kOther>>
   void Initialize(F&& f) {
     InitializeStorage<QualDecayedTRef>(std::forward<F>(f));
   }