<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 12, 2016, at 7:58 , Argyrios Kyrtzidis <<a href="mailto:akyrtzi@gmail.com" class="">akyrtzi@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><blockquote type="cite" style="font-family: Monaco; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">On Feb 12, 2016, at 5:08 AM, Aaron Ballman <<a href="mailto:aaron@aaronballman.com" class="">aaron@aaronballman.com</a>> wrote:<br class=""><br class="">On Thu, Feb 11, 2016 at 11:36 PM, Argyrios Kyrtzidis via llvm-commits<br class=""><<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>> wrote:<br class=""><blockquote type="cite" class="">Author: akirtzidis<br class="">Date: Thu Feb 11 22:36:48 2016<br class="">New Revision: 260654<br class=""><br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=260654&view=rev" class="">http://llvm.org/viewvc/llvm-project?rev=260654&view=rev</a><br class="">Log:<br class="">[ADT] OptionSet: ifdef out some code that seems to be crashing MSVC.<br class=""><br class="">Modified:<br class=""> llvm/trunk/include/llvm/ADT/OptionSet.h<br class=""><br class="">Modified: llvm/trunk/include/llvm/ADT/OptionSet.h<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/OptionSet.h?rev=260654&r1=260653&r2=260654&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/OptionSet.h?rev=260654&r1=260653&r2=260654&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm/ADT/OptionSet.h (original)<br class="">+++ llvm/trunk/include/llvm/ADT/OptionSet.h Thu Feb 11 22:36:48 2016<br class="">@@ -116,6 +116,8 @@ public:<br class=""> }<br class=""><br class="">private:<br class="">+#ifndef _MSC_VER<br class="">+ // This is crashing MSVC.<br class=""> template <typename T><br class=""> static auto _checkResultTypeOperatorOr(T t) -> decltype(t | t) { return T(); }<br class=""><br class="">@@ -124,6 +126,7 @@ private:<br class=""> static_assert(!std::is_same<decltype(_checkResultTypeOperatorOr(Flags())),<br class=""> Flags>::value,<br class=""> "operator| should produce an OptionSet");<br class="">+#endif<br class="">};<br class=""></blockquote><br class="">Are there plans to correct this for MSVC and recommit? Is there a<br class="">requirement for this to use automatic type deduction instead of using<br class="">the decltype in the is_same check, like this:<br class=""><br class=""><a href="http://coliru.stacked-crooked.com/a/94f224987d9feaee" class="">http://coliru.stacked-crooked.com/a/94f224987d9feaee</a><br class=""></blockquote><br style="font-family: Monaco; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Monaco; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">+ Jordan who added that.</span><br style="font-family: Monaco; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></div></blockquote></div><br class=""><div class="">That seems perfectly fine to me—actually, it seems like an improvement. I don't know why I did it the way I did.</div><div class=""><br class=""></div><div class="">Actually, this would be an even better improvement:</div><div class=""><br class=""></div><div class=""> static_assert(std::is_same<decltype(Flags() | Flags()), <br class=""><span class="Apple-tab-span" style="white-space:pre"> </span> OptionSet<Flags>>::value,<br class=""> "operator| should produce an OptionSet");<br class=""><br class=""></div><div class="">…but I'm not sure if that will break any of our existing use cases!</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><div class="">P.S. Argyrios, please switch the uses of swift::OptionSet over to llvm::OptionSet at some point.</div></body></html>