On 8/3/19 9:54 PM, Marek Polacek wrote:
This patch implements P1161R3, Deprecate uses of the comma operator in
subscripting expressions:
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1161r3.html>
which made its way to C++20. New [depr.comma.subscript] shows:
void f(int *a, int b, int c) {
a[b,c]; // deprecated
a[(b,c)]; // OK
}
I've added a new option, -Wcomma-subscript, so that this warning can be
selectively turned off in c++2a, where it is enabled by default, and turned
on in lower standards, to check if your codebase has any occurrences of it,
without needing to change the -std=.
+ /* -Wcomma-subscript is enabled by default in C++20. */
+ if (!global_options_set.x_warn_comma_subscript)
+ warn_comma_subscript = cxx_dialect >= cxx2a;
Let's add "&& warn_deprecated" here, so -Wno-deprecated also turns it off.
OK with that change.
Jason