[clang] [clang][Interp] Handle imaginary literals (PR #79130)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 31 06:59:42 PST 2024


================
@@ -112,11 +112,13 @@ bool Context::evaluateAsInitializer(State &Parent, const VarDecl *VD,
 #endif
 
   // Ensure global variables are fully initialized.
-  if (shouldBeGloballyIndexed(VD) && !Res.isInvalid() &&
-      (VD->getType()->isRecordType() || VD->getType()->isArrayType())) {
+  if (shouldBeGloballyIndexed(VD) &&
+      (VD->getType()->isRecordType() || VD->getType()->isArrayType() ||
+       VD->getType()->isAnyComplexType())) {
     assert(Res.isLValue());
 
-    if (!Res.checkFullyInitialized(C.getState()))
+    if (!VD->getType()->isAnyComplexType() &&
+       !Res.checkFullyInitialized(C.getState()))
----------------
tbaederr wrote:

```suggestion
        !Res.checkFullyInitialized(C.getState()))
```

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


More information about the cfe-commits mailing list