diff options
| author | Shafik Yaghmour <shafik.yaghmour@intel.com> | 2022-12-21 10:47:52 -0800 |
|---|---|---|
| committer | Shafik Yaghmour <shafik.yaghmour@intel.com> | 2022-12-21 10:50:05 -0800 |
| commit | 475cc44a2cba45c5449a323c6b331ddc593bd8de (patch) | |
| tree | 9215b8ab0a281f0af445d08a2104cfaae69ce36d /clang/lib/CodeGen/CGExprAgg.cpp | |
| parent | 5bcd980137822fe0d564062656f96dd0795358da (diff) | |
[Clang] Modify sanity check assert in AggExprEmitter::VisitInitListExpr to cover anonymous struct in a union GNU extension
AggExprEmitter::VisitInitListExpr sanity checks that an empty union is really
empty and not a semantic analysis failure. The assert is missing that we allow
anonymous structs as a GNU extension. I have updated the assert to take that into account.
This fixes: https://github.com/llvm/llvm-project/issues/58800
Differential Revision: https://reviews.llvm.org/D139261
Diffstat (limited to 'clang/lib/CodeGen/CGExprAgg.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExprAgg.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 8ba21f8fc004..303bcc89f671 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -1724,7 +1724,7 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr( // Make sure that it's really an empty and not a failure of // semantic analysis. for (const auto *Field : record->fields()) - assert(Field->isUnnamedBitfield() && "Only unnamed bitfields allowed"); + assert((Field->isUnnamedBitfield() || Field->isAnonymousStructOrUnion()) && "Only unnamed bitfields or ananymous class allowed"); #endif return; } |
