[clang] [clang][Interp] Handle imaginary literals (PR #79130)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 31 05:49:01 PST 2024
================
@@ -112,12 +112,15 @@ 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()))
- return false;
+ if (!VD->getType()->isAnyComplexType()) {
+ if (!Res.checkFullyInitialized(C.getState()))
+ return false;
+ }
----------------
AaronBallman wrote:
```suggestion
if (!VD->getType()->isAnyComplexType() &&
!Res.checkFullyInitialized(C.getState()))
return false;
```
https://github.com/llvm/llvm-project/pull/79130
More information about the cfe-commits
mailing list