Avoid a /analyze internal compiler error with MakeIndexSequence

The recently added MakeIndexSequence templates cause a VC++ internal
compiler error when building with /analyze. This happens on dozens of
source files so disabling /analyze for those files is impractical. This
change conditionally replaces the template recursion with a
straightforward implementation for values from zero to five. This is
sufficient to build Chrome at the moment.

The code which VC++ doesn't like was introduced in change:
https://codereview.chromium.org/693693005

It's an ugly fix, but justified by the desire to allow running
/analyze. The /analyze version of the code will never be run.

A VC++ bug has been filed:

https://connect.microsoft.com/VisualStudio/feedback/details/1053626

BUG=427616

Review URL: https://codereview.chromium.org/803183004

Cr-Commit-Position: refs/heads/master@{#312469}


CrOS-Libchrome-Original-Commit: b132ccda867e4fc8479450db3baf96f1b713b827
diff --git a/base/tuple.h b/base/tuple.h
index 4408074..41c6a00 100644
--- a/base/tuple.h
+++ b/base/tuple.h
@@ -40,6 +40,50 @@
 template <size_t... Ns>
 struct MakeIndexSequenceImpl;
 
+#if defined(_PREFAST_) && defined(OS_WIN)
+
+// Work around VC++ 2013 /analyze internal compiler error:
+// https://connect.microsoft.com/VisualStudio/feedback/details/1053626
+
+template <> struct MakeIndexSequenceImpl<0> {
+  using Type = IndexSequence<>;
+};
+template <> struct MakeIndexSequenceImpl<1> {
+  using Type = IndexSequence<0>;
+};
+template <> struct MakeIndexSequenceImpl<2> {
+  using Type = IndexSequence<0,1>;
+};
+template <> struct MakeIndexSequenceImpl<3> {
+  using Type = IndexSequence<0,1,2>;
+};
+template <> struct MakeIndexSequenceImpl<4> {
+  using Type = IndexSequence<0,1,2,3>;
+};
+template <> struct MakeIndexSequenceImpl<5> {
+  using Type = IndexSequence<0,1,2,3,4>;
+};
+template <> struct MakeIndexSequenceImpl<6> {
+  using Type = IndexSequence<0,1,2,3,4,5>;
+};
+template <> struct MakeIndexSequenceImpl<7> {
+  using Type = IndexSequence<0,1,2,3,4,5,6>;
+};
+template <> struct MakeIndexSequenceImpl<8> {
+  using Type = IndexSequence<0,1,2,3,4,5,6,7>;
+};
+template <> struct MakeIndexSequenceImpl<9> {
+  using Type = IndexSequence<0,1,2,3,4,5,6,7,8>;
+};
+template <> struct MakeIndexSequenceImpl<10> {
+  using Type = IndexSequence<0,1,2,3,4,5,6,7,8,9>;
+};
+template <> struct MakeIndexSequenceImpl<11> {
+  using Type = IndexSequence<0,1,2,3,4,5,6,7,8,9,10>;
+};
+
+#else  // defined(WIN) && defined(_PREFAST_)
+
 template <size_t... Ns>
 struct MakeIndexSequenceImpl<0, Ns...> {
   using Type = IndexSequence<Ns...>;
@@ -49,6 +93,8 @@
 struct MakeIndexSequenceImpl<N, Ns...>
     : MakeIndexSequenceImpl<N - 1, N - 1, Ns...> {};
 
+#endif  // defined(WIN) && defined(_PREFAST_)
+
 template <size_t N>
 using MakeIndexSequence = typename MakeIndexSequenceImpl<N>::Type;