PR c++/91338 - Implement P1161R3: Deprecate a[b,c].
authorMarek Polacek <polacek@redhat.com>
Mon, 5 Aug 2019 19:01:15 +0000 (19:01 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 5 Aug 2019 19:01:15 +0000 (19:01 +0000)
commitab574db6b9b2c06b9d68326a9cab6b4193a303e1
tree99ee5447b6d67c9fb5893ac710b1bca1416b579f
parentea55c91543bd9d78aa006bc9661422ddf4c4a3f1
PR c++/91338 - Implement P1161R3: Deprecate a[b,c].

* c-opts.c (c_common_post_options): Enable -Wcomma-subscript by
default for C++2a, unless -Wno-deprecated.
* c.opt (Wcomma-subscript): New warning.

* parser.c (cp_parser_postfix_open_square_expression): Warn about uses
of a comma operator within a subscripting expression.
(cp_parser_skip_to_closing_square_bracket_1): New function, made out
of...
(cp_parser_skip_to_closing_square_bracket): ...this.

* doc/invoke.texi: Document -Wcomma-subscript.

* g++.dg/cpp2a/comma1.C: New test.
* g++.dg/cpp2a/comma2.C: New test.
* g++.dg/cpp2a/comma3.C: New test.
* g++.dg/cpp2a/comma4.C: New test.

From-SVN: r274121
12 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-opts.c
gcc/c-family/c.opt
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp2a/comma1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/comma2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/comma3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/comma4.C [new file with mode: 0644]