This is perfectly valid and sensible standard C++.
The ternary conditional operator forms an expression, and the expression is a constant expression if its operands are.
The standard reference is C++11 5.19/2:
A conditional-expression is a core constant expression [...]
Note that by 5.16, ternary conditional expressions are one type of conditional-expressions. Other types are things like 2 == 3
.