title: Why can't this enable_if function template be specialized in VS2017?
body: <p>The following compiled with VS2015, but fails in VS2017 with the below errors. Was the code doing something non standard that has been fixed in VS2017, or should VS2017 compile it?</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;type_traits&gt;
  
  template &lt;typename E&gt;
  constexpr auto ToUnderlying(E e)
  {
      return static_cast&lt;std::underlying_type_t&lt;E&gt;&gt;(e);
  }
  
  template&lt;typename T&gt;
  bool constexpr IsFlags(T) { return false; }
  
  template&lt;typename E&gt;
  std::enable_if_t&lt;IsFlags(E{}), std::underlying_type_t&lt;E&gt;&gt; operator | (E lhs, E rhs)
  {
      return ToUnderlying(lhs) | ToUnderlying(rhs);
  }
  
  enum class PlantFlags { green = 1, edible = 2, aromatic = 4, frostTolerant = 8, thirsty = 16, growsInSand = 32 };
  
  bool constexpr IsFlags(PlantFlags) { return true; }
  
  int main()
  {
      auto ored = PlantFlags::green | PlantFlags::frostTolerant;
  
      return 0;
  }
  </code></pre>
  
  <p>Errors are:</p>
  
  <pre><code>c:\main.cpp(24): error C2893: Failed to specialize function template 'enable_if&lt;false,_Ty&gt;::type
  operator |(E,E)'
          with
          [
              _Ty=underlying_type&lt;_Ty&gt;::type
          ] 
  c:\main.cpp(24): note: With the following template arguments:
  c:\main.cpp(24): note: 'E=PlantFlags'
  c:\main.cpp(24): error C2676: binary '|': 'PlantFlags' does not define this operator or a conversion to a type acceptable to the predefined operator
  </code></pre>