Rainer Deyke wrote:
Lars T. Kyllingstad wrote:
Rainer Deyke wrote:
I don't care if x^^y with y < 0 is 0, a runtime error, or even undefined
behavior. However, having different behavior if x is a compile-time
constant than if x is a variable is unacceptable because it silently
changes the (defined) behavior of a function when a runtime parameter is
changed to a template parameter or vice versa, or even when the compiler
becomes a bit more clever about CTFE.
I don't think it's a problem: Either it works as expected, or it causes
a compile-time error.
Not quite. Under the proposal, -1^^-1 works (i.e. produces the correct
result) at compile time but fails at runtime.
It won't pass CTFE.