Well, it looks like the <statement kicks the compiler off the wrong track. If you:
static_assert( Assign_Low_High<L>::low_value > -1, "Incorrect Range");
or
static_assert( (Assign_Low_High<L>::low_value) < 1, "Incorrect Range");
he will work.
If you do:
static_assert( Assign_Low_High<L>::low_value < 1 > 0, "Incorrect Range");
then it becomes interesting ...
I think that the compiler should consider the low_value dependent name as a type-independent name and not consider the type “<” below the low_value will be less than the operator. Therefore, I would say that the gcc compiler does the right thing until the MS 2010 compiler does this, but, fortunately, this can help get the desired effect.
One more thing, this is obviously not due to static_assert, because:
bool bComp = Assign_Low_High<int>::low_value < 1;
directly in the main leads to the same compilation errors ...
source share