Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(730)

Unified Diff: base/tuple.h

Issue 803183004: Work around VC++ /analyze internal compiler error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added support for zero and five. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/tuple.h
diff --git a/base/tuple.h b/base/tuple.h
index 885413f7570e980dbc4c4a2caa4108b2594b8f1a..285b7d0807711c0964ebebead3de84727c8f3698 100644
--- a/base/tuple.h
+++ b/base/tuple.h
@@ -40,6 +40,58 @@ struct IndexSequence {};
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 IndexSequence<0> {};
+
+template <>
+struct IndexSequence<0,1> {};
+
+template <>
+struct IndexSequence<0,1,2> {};
+
+template <>
+struct IndexSequence<0,1,2,3> {};
+
+template <>
+struct IndexSequence<0,1,2,3,4> {};
+
+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>;
+};
+
+#else
+
template <size_t... Ns>
struct MakeIndexSequenceImpl<0, Ns...> {
using Type = IndexSequence<Ns...>;
@@ -49,6 +101,8 @@ template <size_t N, size_t... Ns>
struct MakeIndexSequenceImpl<N, Ns...>
mdempsky 2014/12/15 22:17:55 I previously wrote this as: template <size_t
: MakeIndexSequenceImpl<N - 1, N - 1, Ns...> {};
+#endif
+
template <size_t N>
using MakeIndexSequence = typename MakeIndexSequenceImpl<N>::Type;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698