Why is the Visual Studio C++ Compiler rejecting an enum as a template parameter? : <p>I'm using the Microsoft Visual Studio 2019 compiler (cl.exe), and it is rejecting some code accepted by both Clang and GCC, related to using enums as template parameters, where the templates are specialized for particular enum values.</p>

<pre><code>enum Foo {
    Bar,
    Baz
};

template&lt;enum Foo = Bar&gt; class Clazz {

};

template&lt;&gt; class Clazz&lt;Baz&gt; {

};
</code></pre>

<p>The VC++ compiler reports several errors on the template specialization:</p>

<pre><code>&lt;source&gt;(10): error C2440: 'specialization': cannot convert from 'Foo' to 'Foo'
&lt;source&gt;(10): note: Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
</code></pre>

<p>This code is accepted without errors by both Clang and GCC. Is this a bug with VC++?</p>

<p>Replacing the 'enum Foo' in the template declaration with just 'int' causes the errors to go away. However, this is not an acceptable answer, as I'm trying to port a large code base over to VC++.</p>
