[clang] [Clang] support storage-class specifiers in C23 compound literals (PR #212559)
Oleksandr Tarasiuk via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 29 00:56:46 PDT 2026
================
@@ -1360,8 +1360,10 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
else
Ty = VD->getType();
- if (Ty->isVariablyModifiedType())
+ if (Ty->isVariablyModifiedType()) {
+ RunCleanupsScope Scope(*this);
----------------
a-tarasyuk wrote:
```cpp
typedef struct { x value; } S;
int size(const S *);
int f(int a[size(&(constexpr S){ 0 })]) { return a[0]; }
```
My understanding is that the compound literal should remain alive until f returns. `RunCleanupsScope` transfers its cleanup to the function's cleanup scope rather than running it immediately. Is there a better way to handle this?
https://github.com/llvm/llvm-project/pull/212559
More information about the cfe-commits
mailing list