|
|
|
|
|
by tsimionescu
1166 days ago
|
|
But foo(1) is a constant expression, and the compiler accepts it. Not sure what you mean by a "constexpr expression" exactly. My point is that a function can legally be constexpr-qualified even if it can produce UB when called with certain arguments. I think it's very common to call such a function "a constexpr function". Of course, we agree that not every expression where a constexpr function is called is a constant expression (such as foo(100) in my example). However, expressions where that function is called with arguments where it does not produce UB are legal constant expressions (such as foo(1) in my example). Perhaps I misunderstood your original comment and we are in fact in violent agreement. If so I apologize. |
|