using g++ and compiling with -Waggregate-return
#define DOCTEST_CHECK(expr) \
do { \
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Waggregate-return\"");\
if(Result failed = (ExpressionDecomposer() << expr)) \
printf("%s\n", failed.m_decomposition.c_str()); \
_Pragma("GCC diagnostic pop"); \
} while(false)
DOCTEST_CHECK(true == false); // produces warnings
but the unrolled by hand version does not produce any warnings:
do {
_Pragma("GCC diagnostic push");
_Pragma("GCC diagnostic ignored \"-Waggregate-return\"");
if(Result failed = (ExpressionDecomposer() << true == false))
printf("%s\n", failed.m_decomposition.c_str());
_Pragma("GCC diagnostic pop");
} while(false);
Shouldn't the behavior be the same?
I don't think the Result
and ExpressionDecomposer
types matter - just classes.
I'm trying to get expression decomposition working like here (things have been renamed a bit).
EDIT: >> here << is a live demo of the problem using the lest library
My question is: why? how can I be warning free in the first case using the macro? I cannot afford silencing the warning globally.
These bugs look relevant:
So it might have to do with line number comparisons, or some similar issue within the parser, and it might be fixed in some future version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With