DHowett-MSFT added a comment. While this fixes the assertion failure and the immediate issue of whether packing _works_ inside delay-parsed templates in a PCH, it does reveal a follow-on issue that I can't quite trace out.
c++ template <typename T> void foo() { #pragma pack(push, 1) #pragma pack(show) #pragma pack(pop) } results in... unterminated '#pragma pack (push, ...)' at end of file I've stepped through ASTReader and verified that we do get all three expected pack pragma nodes {PSK_Push, ..., 1} {PSK_Show} {PSK_Pop, ...} suggesting that there's something later down the line that messes up the pack stack. ================ Comment at: clang/test/PCH/delayed-template-with-pragma-pack.cpp:14 +int func() { +#pragma pack(push, 1) + struct s { short a; T b; }; ---------------- mikerice wrote: > Your test should include testing of the slot string too, so we are sure all > fields are serialized and restored correctly. Otherwise this looks reasonable > to me. So, I've identified an additional wrinkle... Unlike `#pragma omp`, `#pragma pack` and `... align` don't show up in the AST dump/reprint and I cannot verify their continued existence; this is true _even without delayed template expansion or PCH generation._ alignment/packing seem to not be stored as Attrs, so they don't get printed via attr print on the AST nodes or (prettily) via the tablegen-generated pretty printers. Fixing this is somewhat beyond me at the moment. :) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D143410/new/ https://reviews.llvm.org/D143410 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits