我有以下代码:
template<int lengthAfter>
class VariableString{
public:
enum{
fieldSize = -1000
};
....
};
template<typename T, int FieldSize = sizeof(T)>
class field_trait{
public:
enum{
fieldSize = FieldSize
};
....
};
template<int lengthAfter>
class field_trait<VariableString<lengthAfter>, -1000>{
public:
enum{
fieldSize = -1000
};
....
};
static_assert(field_trait<VariableString<0> >::fieldSize == -1000, "VariableString length error");
当我编译时,static_assert
我期望专业化工作的失败。我哪里错了?