[clang] [CIR] Implement aggregate-expr-init with a const-expr lowering (PR #190631)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 6 11:27:17 PDT 2026


================
@@ -303,7 +304,19 @@ class AggExprEmitter : public StmtVisitor<AggExprEmitter> {
                      "AggExprEmitter: VisitSubstNonTypeTemplateParmExpr");
   }
   void VisitConstantExpr(ConstantExpr *e) {
-    cgf.cgm.errorNYI(e->getSourceRange(), "AggExprEmitter: VisitConstantExpr");
+    ensureDest(cgf.getLoc(e->getSourceRange()), e->getType());
+
+    if (mlir::Attribute result = ConstantEmitter(cgf).tryEmitConstantExpr(e)) {
----------------
andykaylor wrote:

FWIW, it looks like the call to tryEmitConstantExpr was added here: https://github.com/llvm/llvm-project/commit/51e4aa87e05c45bebf9658a47980b1934c88be31#diff-9cc9cfa9ad2060b97c7bf2689654a4b54799316d0557775ecf6d9d9b21af7b46

The fallthrough branch was executed unconditionally before that change.

I tried using Claude to find a case that would hit this code, and it claims it can happen when Pointer Field Protection is used.

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


More information about the cfe-commits mailing list