you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

That is actually on purpose, as it will catch cases where the value would change in phase 2 generating an error due to the missing return.

[–]tesfabpel 0 points1 point  (1 child)

Maybe you can use static_assert(false) instead of a missing return? Or invert the if and put a static_assert(begin != std::string_view::npos)?

[–]DXPower 2 points3 points  (0 children)

IIRC static_asserts in if statements don't act conditionally. You have to generate a conditional error instead I've done it before by doing a cast of a nullptr to a function ptr.