Why is the Visual Studio C++ Compiler rejecting an enum as a template parameter?

You are missing a T:

template<enum Foo T = Bar> class Clazz {

Or have an extra enum:

template<Foo = Bar> class Clazz {

This second one is much nicer, thanks François.


Your code will compile if you use the Standards Conformance Mode compiler option /permissive- to specify standards-conforming compiler behavior.

You can add that option on the command line or in the "Project property page -> C/C++ -> Language -> Conformance mode".