[clang] [clang] Reject initializing constexpr struct/union types with compound literals that contain non null pointers (PR #228776)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 5 04:54:51 PDT 2026


================
@@ -2176,6 +2175,14 @@ static bool CheckLValueConstantExpression(EvalInfo &Info, SourceLocation Loc,
                                           QualType Type, const LValue &LVal,
                                           ConstantExprKind Kind,
                                           CheckedTemporaries &CheckedTemps) {
+  if (Info.getLangOpts().C23 && !LVal.isNullPointer()) {
----------------
AaronBallman wrote:

It might make sense to make a helper function for this because https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3937.pdf got a warm reception in Ottawa (it was not adopted but it shows the committee is potentially going to make the rules more complicated in the near future).

https://github.com/llvm/llvm-project/pull/228776


More information about the cfe-commits mailing list