This revision was automatically updated to reflect the committed changes.
Closed by commit rGa5ab650714d0: [clang] Fix a crash in constant evaluation 
(authored by kadircet).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132918

Files:
  clang/lib/AST/ExprConstant.cpp


Index: clang/lib/AST/ExprConstant.cpp
===================================================================
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -4794,6 +4794,11 @@
       Result = APValue((const FieldDecl *)nullptr);
       return true;
     }
+    // Can't access properties of an incomplete type.
+    if (!RD->hasDefinition()) {
+      Result = APValue();
+      return false;
+    }
     Result = APValue(APValue::UninitStruct(), RD->getNumBases(),
                      std::distance(RD->field_begin(), RD->field_end()));
 


Index: clang/lib/AST/ExprConstant.cpp
===================================================================
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -4794,6 +4794,11 @@
       Result = APValue((const FieldDecl *)nullptr);
       return true;
     }
+    // Can't access properties of an incomplete type.
+    if (!RD->hasDefinition()) {
+      Result = APValue();
+      return false;
+    }
     Result = APValue(APValue::UninitStruct(), RD->getNumBases(),
                      std::distance(RD->field_begin(), RD->field_end()));
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to