Templates and __builtin-constant_p

Not possible sorry, join my band wagon and encourage Arduino to accept c++11, the constexpr keyword is what you are looking for. I'm pretty sure its just a command line flag change.

C++, as a rule instantiates everything at compile time ( its how it can optimise ), templates however cannot be instantiated until parameters are provided. So each specific variation of a template is specific to its parameters. Which means you cannot instantiate a template at runtime as there is no specific parameters compiled for it.

Mutable variables are not considered compile time constants. Even when marked as const ( taking the address can allow changing of the data )