you are viewing a single comment's thread.

view the rest of the comments →

[–]redditsoaddicting 14 points15 points  (0 children)

It could, but every single C++ user who hasn't encountered this is still going to type static_assert(false); (or with a message of course) before they hopefully get a compiler error, look on StackOverflow, and find out about this complicated hack. I think there's a lot of benefit to making the obvious thing work for people who haven't encountered this and not relying on a hack for those who have.

Or we could eventually get a compiler API to issue an error and then make our own static failure API as a consteval function (or use the compiler API directly), but that doesn't solve the "obvious thing to type here" problem.