[PATCH] D76096: [clang] allow const structs to be constant expressions in initializer lists

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 12 14:07:10 PDT 2020


nickdesaulniers marked an inline comment as not done.
nickdesaulniers added inline comments.


================
Comment at: clang/lib/AST/Expr.cpp:3164
+      const QualType &QT = cast<DeclRefExpr>(this)->getDecl()->getType();
+      if (QT->isStructureType() && QT.isConstQualified())
+        return true;
----------------
nickdesaulniers wrote:
> Interesting, playing with this more in godbolt, it looks like the struct doesn't even have to be const qualified.
Or, rather, behaves differently between C and C++ mode;

C -> const required
C++ -> const not required


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76096/new/

https://reviews.llvm.org/D76096





More information about the cfe-commits mailing list