From 9fdd8bcd69524fa1af3ed4cbff21c2f8240826f4 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sun, 21 Jul 2019 15:27:07 +0200 Subject: [PATCH] P1161R3 Deprecate uses of the comma operator in subscripting expressions --- source/expressions.tex | 16 ++++++++++++++++ source/future.tex | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/source/expressions.tex b/source/expressions.tex index a472c33226..b985bbbc77 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -2862,6 +2862,14 @@ if that operand is an lvalue and an xvalue otherwise. The expression \tcode{E1} is sequenced before the expression \tcode{E2}. +\pnum +\begin{note} +A comma expression\iref{expr.comma} +appearing as the \grammarterm{expr-or-braced-init-list} +of a subscripting expression is deprecated; +see \ref{depr.comma.subscript}. +\end{note} + \pnum \begin{note} Despite its asymmetric appearance, subscripting is a commutative @@ -6793,6 +6801,14 @@ \tcode{5}. \end{example} +\pnum +\begin{note} +A comma expression +appearing as the \grammarterm{expr-or-braced-init-list} +of a subscripting expression\iref{expr.sub} is deprecated; +see \ref{depr.comma.subscript}. +\end{note} + \rSec1[expr.const]{Constant expressions}% \indextext{expression!constant} diff --git a/source/future.tex b/source/future.tex index 5c541d9da3..ba0b570eb3 100644 --- a/source/future.tex +++ b/source/future.tex @@ -54,6 +54,24 @@ \end{codeblock} \end{example} +\rSec1[depr.comma.subscript]{Comma operator in subscript expressions} + +\pnum +A comma expression\iref{expr.comma} +appearing as the \grammarterm{expr-or-braced-init-list} +of a subscripting expression\iref{expr.sub} is deprecated. +\begin{note} +A parenthesized comma expression is not deprecated. +\end{note} +\begin{example} +\begin{codeblock} +void f(int *a, int b, int c) { + a[b,c]; // deprecated + a[(b,c)]; // OK +} +\end{codeblock} +\end{example} + \rSec1[depr.array.comp]{Array comparisons} \pnum