================
@@ -930,6 +930,22 @@ bool CheckLocalLoad(InterpState &S, CodePtr OpPC, const 
Block *B) {
   return true;
 }
 
+/// A compound literal with static storage duration can be modified unless it
+/// is const-qualified, so its value is not known.
+static bool CheckCompoundLiteral(InterpState &S, CodePtr OpPC, const Block *B) 
{
+  const auto *CLE =
+      dyn_cast_if_present<CompoundLiteralExpr>(B->getDescriptor()->asExpr());
+  if (!CLE || !CLE->hasStaticStorage() ||
+      CLE->getType().isConstant(S.getASTContext()))
+    return true;
+
+  S.FFDiag(S.Current->getLocation(OpPC),
+           diag::note_invalid_subexpr_in_const_expr)
----------------
tbaederr wrote:

```suggestion
  S.FFDiag(S.Current->getSource(OpPC),
           diag::note_invalid_subexpr_in_const_expr, 1)
```

https://github.com/llvm/llvm-project/pull/241126
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to