https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110348
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to corentinjabot from comment #9) > During review in clang we felt that it diagnosing it it all cases > would be preferable to our users, as otherwise errors only manifest when the > static assertion fails, > likely at a point where the person getting the diagnostic would not be able > to act on it. > So we made it a warning that defaults to an error. Then it should be a warning rather than error IMHO. Because it isn't invalid, just likely unintended. > See https://github.com/cplusplus/CWG/issues/350, because i was confused too. > `data()` is a core constant expression. the implementation should behave _as > if_ `T{}.data ()[N]` is evaluated for each `N` > even if that would be pretty bad implementation strategy. Jason, do we have a way to test whether something is a core constant expression in the FE? Seems the https://eel.is/c++draft/expr.const#13 checks are done in cxx_eval_outermost_constant_expression and I don't see a way to ignore them. Because for N > 0, I think we can as well check it just by evaluating T{}.data ()[0] etc., but for N == 0 we can't.