jcranmer-intel wrote: I've been doing some testing, and I do want to confirm my understanding of the C standard here.
>From what I can tell, macro expansion (phase 4) happens before constants are >parsed (phase 7). As a result, if you have code like this: ```c #define CONSTANT 0.1f ``` the interpretation of `0.1f` depends on the state of the pragma at point of use of the macro, not point of declaration of the macro. Given that pragmas can be defined with `_Pragma`, with lambdas or statement expressions (albeit neither of which is standard C), it should be possible to create a macro that evaluates a constant with a given rounding mode: ```c++ #define rendevous(x) _Pragma(#x) #define CONSTANT(RM, x) ([](){ rendevous(STDC FENV_ROUND RM); return x; })()) ``` This does seem to indeed be the behavior of the current implementation, but I would like to see some tests in the test code confirming that it's the macro use, not the `#define` that determines the interpretation of the constant, and another test for the `_Pragma` case. https://github.com/llvm/llvm-project/pull/90877 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits