Skip to content
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

Warning: "possible misuse of comma operator here [-Werror,-Wcomma]" #398

Closed
claremacrae opened this issue Oct 8, 2020 · 0 comments
Closed

Comments

@claremacrae
Copy link
Contributor

claremacrae commented Oct 8, 2020

This is more of a question than a bug report, as I haven't managed to narrow down my configuration enough to give you a minimal repro.

The question is: is the comma operator in this code intentional, and if so, could a static cast be added to silence the warning?

In some of my builds, where I treat warnings as errors, I am getting this:

/Users/clare/Documents/develop/ApprovalTests/ApprovalTests.cpp.CMakeSamples/ut/include/boost/ut.hpp:210:9: error: possible misuse of comma operator here [-Werror,-Wcomma]
    ++pi, ++si;
        ^
/Users/clare/Documents/develop/ApprovalTests/ApprovalTests.cpp.CMakeSamples/ut/include/boost/ut.hpp:210:5: note: cast expression to void to silence warning
    ++pi, ++si;
    ^~~~
    static_cast<void>( )
1 error generated.

Specifications

  • Version: bba087c
  • Platform: macOS
  • Subsystem:
/opt/local/bin/clang-mp-9.0 --version
clang version 9.0.1 
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-9.0/bin
krzysztof-jusiak added a commit to krzysztof-jusiak/ut that referenced this issue Oct 8, 2020


Problem:
- There is a valid warning of potentially misuse of comma operator in match function.

Solution:
- Use semicolon instead of comma to avoid the warning and make the intend cleaner.
- Add gherkin unit test to verify the behaviour of match in an integration test.
krzysztof-jusiak added a commit to krzysztof-jusiak/ut that referenced this issue Oct 8, 2020


Problem:
- There is a valid warning of potentially misuse of comma operator in match function.

Solution:
- Use semicolon instead of comma to avoid the warning and make the intend cleaner.
- Add gherkin unit test to verify the behaviour of match in an integration test.
krzysztof-jusiak added a commit to krzysztof-jusiak/ut that referenced this issue Oct 8, 2020


Problem:
- There is a valid warning of potentially misuse of comma operator in match function.

Solution:
- Use semicolon instead of comma to avoid the warning and make the intend cleaner.
- Add gherkin unit test to verify the behaviour of match in an integration test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant