From 804b7fcb2f12419d0900a20970c35ef3a1abd60d Mon Sep 17 00:00:00 2001 From: "Philipp A. Hartmann" Date: Sat, 30 Aug 2014 16:39:15 +0200 Subject: [PATCH] GenericValue: add static assert to catch broken SFINAE Before applying the simplifications in ed282b814, the SFINAE check for the GenericValue(bool) constructor has been broken in MSVC 2005. Add a static assert as a safe-guard against future reappearance of this problem. --- include/rapidjson/document.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index 83e984a..cd0ca22 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -458,7 +458,10 @@ public: #else explicit GenericValue(bool b) #endif - : data_(), flags_(b ? kTrueFlag : kFalseFlag) {} + : data_(), flags_(b ? kTrueFlag : kFalseFlag) { + // safe-guard against failing SFINAE + RAPIDJSON_STATIC_ASSERT((internal::IsSame::Value)); + } //! Constructor for int value. explicit GenericValue(int i) : data_(), flags_(kNumberIntFlag) {