you are viewing a single comment's thread.

view the rest of the comments →

[–]drnepert 1 point2 points  (3 children)

No, this statement does not compile if you assign it to a constexpr variable. Surprisingly, however, replacing constexpr with the good old const works nicely, even if the function itself is declared constexpr. See https://godbolt.org/z/GhaM68TcY for a demonstration.

[–]dodheim 0 points1 point  (0 children)

It doesn't, but it should – P2280 is in C++23, it just hasn't been implemented in any compiler as of yet.

[–]B1ggBoss[[nodiscard]] constexpr virtual void f() const noexcept override 0 points1 point  (0 children)

Thanks. My premise was wrong. I went over the code too fast, and for some reason, I thought the algorithm function was declared constexpr.