Skip to content

Commit b6d9e27

Browse files
authored
[depr.volatile] Add examples of deprecated constructs
1 parent 948775f commit b6d9e27

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

source/future.tex

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,61 @@
9898
prefix \tcode{++} and \tcode{\dcr} expressions\iref{expr.pre.incr}
9999
of \tcode{volatile}-qualified arithmetic and pointer types are deprecated.
100100

101+
\begin{example}
102+
\begin{codeblock}
103+
volatile int velociraptor;
104+
++velociraptor; // deprecated
105+
\end{codeblock}
106+
\end{example}
107+
108+
101109
\pnum
102110
Certain assignments
103111
where the left operand is a \tcode{volatile}-qualified non-class type
104112
are deprecated; see~\ref{expr.ass}.
105113

114+
\begin{example}
115+
\begin{codeblock}
116+
int neck, tail;
117+
volatile int brachiosaur;
118+
brachiosaur = neck; // OK
119+
tail = brachiosaur; // OK
120+
tail = brachiosaur = neck; // deprecated
121+
brachiosaur += neck; // deprecated
122+
brachiosaur = brachiosaur + neck; // OK
123+
\end{codeblock}
124+
\end{example}
125+
126+
106127
\pnum
107128
A function type\iref{dcl.fct}
108129
with a parameter with \tcode{volatile}-qualified type or
109130
with a \tcode{volatile}-qualified return type is deprecated.
110131

132+
\begin{example}
133+
\begin{codeblock}
134+
volatile struct amber jurassic(); // deprecated
135+
void trex(volatile short left_arm, volatile short right_arm); // deprecated
136+
void fly(volatile struct pterosaur* pteranodon); // OK
137+
\end{codeblock}
138+
\end{example}
139+
140+
111141
\pnum
112142
A structured binding\iref{dcl.struct.bind} of a \tcode{volatile}-qualified type
113143
is deprecated.
114144

145+
\begin{example}
146+
\begin{codeblock}
147+
struct linhenykus { short forelimb; };
148+
void park(linhenykus alvarezsauroid) {
149+
volatile auto [what_is_this] = alvarezsauroid; // deprecated
150+
// ...
151+
}
152+
\end{codeblock}
153+
\end{example}
154+
155+
115156
\rSec1[depr.static.constexpr]{Redeclaration of \tcode{static constexpr} data members}
116157

117158
\pnum

0 commit comments

Comments
 (0)