From: Elizabeth Smith Date: Thu, 10 Jul 2014 21:54:28 +0000 (-0700) Subject: Expression SFINAE issue in base.h X-Git-Tag: v0.22.0~461 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=1f1ba9066520a04ee392cd26c2252be12585f40b;p=folly.git Expression SFINAE issue in base.h Summary: MSVC 14 is still broken with expression sfinae - and the things that break are often strange Moving this out into two expr templates solves the compilation issue Test Plan: fbconfig -r folly && fbmake runtests Reviewed By: tjackson@fb.com FB internal diff: D1413297 --- diff --git a/folly/gen/Base.h b/folly/gen/Base.h index 2c8c2635..bbae117a 100644 --- a/folly/gen/Base.h +++ b/folly/gen/Base.h @@ -537,12 +537,29 @@ enum MemberType { Mutable }; +/** + * These exist because MSVC has problems with expression SFINAE in templates + * assignment and comparisons don't work properly without being pulled out + * of the template declaration + */ +template struct ExprIsConst { + enum { + value = Constness == Const + }; +}; + +template struct ExprIsMutable { + enum { + value = Constness == Mutable + }; +}; + template, class Map = detail::Map> -typename std::enable_if::type +typename std::enable_if::value, Map>::type member(Return (Class::*member)() const) { return Map(Mem(member)); } @@ -552,7 +569,7 @@ template, class Map = detail::Map> -typename std::enable_if::type +typename std::enable_if::value, Map>::type member(Return (Class::*member)()) { return Map(Mem(member)); }