[clang] [clang][CodeGen] Check initializer of zero-size fields for nullptr (PR #109271)
Michael Buch via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 20 10:16:56 PDT 2024
================
@@ -738,7 +738,7 @@ bool ConstStructBuilder::Build(const InitListExpr *ILE, bool AllowOverwrite) {
// Zero-sized fields are not emitted, but their initializers may still
// prevent emission of this struct as a constant.
if (isEmptyFieldForLayout(CGM.getContext(), Field)) {
- if (Init->HasSideEffects(CGM.getContext()))
+ if (Init && Init->HasSideEffects(CGM.getContext()))
----------------
Michael137 wrote:
Thanks for confirming. I'll put up a PR for that separately. Though we'll still have to go ahead with this null check, for the non-C23 case (unless we want to extend this logic for the GNU extension too?)
https://github.com/llvm/llvm-project/pull/109271
More information about the cfe-commits
mailing list