summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--googlemock/include/gmock/gmock-matchers.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 26fe8d2e..73be7c99 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -4098,7 +4098,12 @@ class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> {
const char* sep = "";
// Workaround spurious C4189 on MSVC<=15.7 when k is empty.
(void)sep;
- const char* dummy[] = {"", (*os << sep << "#" << k, sep = ", ")...};
+ // The static_cast to void is needed to silence Clang's -Wcomma warning.
+ // This pattern looks suspiciously like we may have mismatched parentheses
+ // and may have been trying to use the first operation of the comma operator
+ // as a member of the array, so Clang warns that we may have made a mistake.
+ const char* dummy[] = {
+ "", (static_cast<void>(*os << sep << "#" << k), sep = ", ")...};
(void)dummy;
*os << ") ";
}