static_assert
works fine, is your code that never assert.
The template struct X
defines low
and high
as of type IntT
. They are both the same type, whatever values they have.
When you instantiate the struct (X<char,1,'a'> x
) you are telling the compiler that the type of IntT
is char
and are giving to low
the value 1
and to high
the value 'a'
(i.e. 97). However, the type of low
and high
is always char
so the static_assert
will never assert.
solved decltype in static_assert