-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add parentheses around macro argument "expr" #848
Conversation
Could you give an example of what
(But, again, you will lose the fine grained reporting). |
I am not quite sure what you mean with:
What do you lose exactly when you put a parentheses around I will leave an example asap. |
int a = 6*9;
REQUIRE( a == theAnswer() ); The failure output will tell you that the expression expanded to REQUIRE( ( a == theAnswer() ) ); With the extra parentheses the failure output will tell you that the expression expanded to |
Oh, sorry - you are absolutely right, I didn't see it. So my fix is totally wrong. Sorry for this! But the warning still exists:
test1, test2 and test3 raise a warning. And this is very annoying because warnings are errors for us... Please see: Seems to be a gcc bug... or? |
Yeah, there is a problem with warning suppression inside templated tests, that I am not quite sure how to fix. Basically, if you are on a new-enough gcc (4.8+), then we use suppression based on A solution is to do what we do for old gccs, just use |
I'm going to close this PR as we've established it is not applicable. |
Without paranteses arround the macro argument "expr" the used overloaded operator, the execution order and the resulting type is not clear for all macro substitutions:
Example:
On GCC I get the warning without parentheses:
warning: suggest parentheses around comparison in operand of ‘==’ [-Wparentheses]