[PATCH] D132918: [clang] Fix a crash in constant evaluation

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 30 09:39:02 PDT 2022


shafik added inline comments.


================
Comment at: clang/lib/AST/ExprConstant.cpp:4797
     }
+    // Can't access properties of an incomplete type.
+    if (!RD->hasDefinition()) {
----------------
erichkeane wrote:
> It seems to me that we shouldn't GET to this function with an incomplete type.  I suspect whoever calls this is doing so incorrectly.
Also note we only check in `ExprConstant.cpp` for `hasDefinition()` in one other place in `findCompleteObject` and that is around extern see: https://github.com/llvm/llvm-project/commit/c0d04a2567c22631595bed8092bc042bb91ea4ee#diff-255a21a02a8966766225831836d482547787baf9a770fbf67178ebb7d7347e27


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132918



More information about the cfe-commits mailing list