rjmccall wrote: > pragma pack uses pragma stack and it is allowed in any place: > https://godbolt.org/z/f8fP1vn63 . If such pragma presents in the late-parsed > template, and push-pop operations in it are not balanced, the late parse of > such function can break the pragma stack and next templates can be parsed > incorrectly. It is not a FP pragma, but it demonstrates that the compiler > must provide some Sema state isolation for late parsed templates.
Okay, so if we accept this, this is a hard constraint on our ability to do late parsing of function bodies in situations not blessed by the language. We could decide not to support that — we probably have to support uses of `#pragma pack` within a function, but we could e.g. emit an error if the effect of the pragmas is non-local (or a warning saying that we're going to ignore it). It looks like MSVC clears the stack before it does late parsing: you get a warning if you put your test function inside a class body. https://github.com/llvm/llvm-project/pull/70646 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits