spavloff wrote:

> To be clear, we're still ensuring the current pragma state during 
> instantiation is what it was when the template is parsed, we're just not 
> incorrectly dropping all of the saved pragma state when we're doing it?

Yes, the pragma is used at parse stage to set correct FP options is AST nodes. 
During template instantiation the function `resetFPOptions` is used to set the 
required FP options in Sema, because in some cases (ImplicitCast) the options 
are taken from Sema and not AST node. As a result the new AST nodes get FP 
otions as they are specified in the template pattern.

The issue with `resetFPOptions` was that it also reset pragma stack. It is OK 
for late template parse, or for the functions that are instantiated at the end 
of translation unit, but not for templates that are instantiated immediately, 
like consexpr functions.

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

Reply via email to