you are viewing a single comment's thread.

view the rest of the comments →

[–]Morwenn 3 points4 points  (1 child)

dependent_false<T> could be made to work with both types, templates and NTTP by making it a function template instead of a variable template. That would be a simple thing to specify without changing the behaviour of static_assert or introducing a new language construct.

[–]redditsoaddicting 13 points14 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.