Let\'s say I have these template aliases:
enum class enabler {};
template
using EnableIf = typename std::enable_if::
First and foremost, thanks to @Richard Smith on the #llvm IRC Channel on oftc for the explanation.
Unfortunately, this is not legal C++ and as such Clang is correct: {}
is not an expression but a braced-init-list and as such will never be a constant expression as is needed in the initializer of a non-type template parameter.
§14.3.2 [temp.arg.non-type] p1
A template-argument for a non-type, non-template template-parameter shall be one of:
- for a non-type template-parameter of integral or enumeration type, a converted constant expression (5.19) of the type of the template-parameter; or
- [...]
One solution would be a dummy value in enabler
.