[PATCH] D141690: [clang] fix consteval ctor code generation assert

Luke Nihlen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 13 07:01:00 PST 2023


luken-google added a comment.

See: https://github.com/llvm/llvm-project/issues/53983

I can add a release note and some testing, but wanted feedback that this was the right approach. The problem is when generating code for the constructor for the `bar` element inside of `MyStruct`, `Dest` has an elementType of `Base`, but `Builder.CreateStructGEP` assumes the `{i8, i8}` layout implied by `Base`. which causes an assert trying to emit code for the second element. So, I've added logic to make sure the layout of `STy` and `Dest` are identical, which fixes the assert but doesn't break any of the existing testing around aggregate stores.

AFAICT the AST and lowering all looks correct, and this is an issue in code generation. But this is a new area of clang for me so I'd welcome suggestions about if there is a better fix or if the fix should be in a different place. Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141690/new/

https://reviews.llvm.org/D141690



More information about the cfe-commits mailing list