Skip to content

Commit 1d1f13a

Browse files
authored
Merge 2023-02 CWG Motion 4
P2796R0 Core Language Working Group "ready" issues for the February, 2023 meeting; issue 2521
2 parents 7452792 + f6760ca commit 1d1f13a

File tree

4 files changed

+40
-24
lines changed

4 files changed

+40
-24
lines changed

source/future.tex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,15 @@
188188
It is possible that future versions of \Cpp{} will specify
189189
that these implicit definitions are deleted\iref{dcl.fct.def.delete}.
190190

191+
\rSec1[depr.lit]{Literal operator function declarations using an identifier}
192+
193+
\pnum
194+
A \grammarterm{literal-operator-id}\iref{over.literal} of the form
195+
\begin{codeblock}
196+
operator @\grammarterm{string-literal}@ @\grammarterm{identifier}@
197+
\end{codeblock}
198+
is deprecated.
199+
191200
\rSec1[depr.template.template]{\tcode{template} keyword before qualified names}
192201

193202
\pnum

source/lex.tex

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,9 @@
968968
\indextext{\idxcode{_}|see{character, underscore}}%
969969
\indextext{character!underscore!in identifier}%
970970
\indextext{reserved identifier}%
971-
In addition, some identifiers are reserved for use by \Cpp{}
971+
In addition, some identifiers
972+
appearing as a \grammarterm{token} or \grammarterm{preprocessing-token}
973+
are reserved for use by \Cpp{}
972974
implementations and shall
973975
not be used otherwise; no diagnostic is required.
974976
\begin{itemize}
@@ -2257,19 +2259,19 @@
22572259
parameter type \tcode{unsigned long long}, the literal \placeholder{L} is treated as a call of
22582260
the form
22592261
\begin{codeblock}
2260-
operator "" @\placeholder{X}@(@\placeholder{n}@ULL)
2262+
operator ""@\placeholder{X}@(@\placeholder{n}@ULL)
22612263
\end{codeblock}
22622264
Otherwise, \placeholder{S} shall contain a raw literal operator
22632265
or a numeric literal operator template\iref{over.literal} but not both.
22642266
If \placeholder{S} contains a raw literal operator,
22652267
the literal \placeholder{L} is treated as a call of the form
22662268
\begin{codeblock}
2267-
operator "" @\placeholder{X}@("@\placeholder{n}@")
2269+
operator ""@\placeholder{X}@("@\placeholder{n}@")
22682270
\end{codeblock}
22692271
Otherwise (\placeholder{S} contains a numeric literal operator template),
22702272
\placeholder{L} is treated as a call of the form
22712273
\begin{codeblock}
2272-
operator "" @\placeholder{X}@<'@$c_1$@', '@$c_2$@', ... '@$c_k$@'>()
2274+
operator ""@\placeholder{X}@<'@$c_1$@', '@$c_2$@', ... '@$c_k$@'>()
22732275
\end{codeblock}
22742276
where \placeholder{n} is the source character sequence $c_1c_2...c_k$.
22752277
\begin{note}
@@ -2283,19 +2285,19 @@
22832285
with parameter type \tcode{long double}, the literal \placeholder{L} is treated as a call of
22842286
the form
22852287
\begin{codeblock}
2286-
operator "" @\placeholder{X}@(@\placeholder{f}@L)
2288+
operator ""@\placeholder{X}@(@\placeholder{f}@L)
22872289
\end{codeblock}
22882290
Otherwise, \placeholder{S} shall contain a raw literal operator
22892291
or a numeric literal operator template\iref{over.literal} but not both.
22902292
If \placeholder{S} contains a raw literal operator,
22912293
the \grammarterm{literal} \placeholder{L} is treated as a call of the form
22922294
\begin{codeblock}
2293-
operator "" @\placeholder{X}@("@\placeholder{f}@")
2295+
operator ""@\placeholder{X}@("@\placeholder{f}@")
22942296
\end{codeblock}
22952297
Otherwise (\placeholder{S} contains a numeric literal operator template),
22962298
\placeholder{L} is treated as a call of the form
22972299
\begin{codeblock}
2298-
operator "" @\placeholder{X}@<'@$c_1$@', '@$c_2$@', ... '@$c_k$@'>()
2300+
operator ""@\placeholder{X}@<'@$c_1$@', '@$c_2$@', ... '@$c_k$@'>()
22992301
\end{codeblock}
23002302
where \placeholder{f} is the source character sequence $c_1c_2...c_k$.
23012303
\begin{note}
@@ -2313,11 +2315,11 @@
23132315
a well-formed \grammarterm{template-argument},
23142316
the literal \placeholder{L} is treated as a call of the form
23152317
\begin{codeblock}
2316-
operator "" @\placeholder{X}@<@\placeholder{str}{}@>()
2318+
operator ""@\placeholder{X}@<@\placeholder{str}{}@>()
23172319
\end{codeblock}
23182320
Otherwise, the literal \placeholder{L} is treated as a call of the form
23192321
\begin{codeblock}
2320-
operator "" @\placeholder{X}@(@\placeholder{str}{}@, @\placeholder{len}{}@)
2322+
operator ""@\placeholder{X}@(@\placeholder{str}{}@, @\placeholder{len}{}@)
23212323
\end{codeblock}
23222324

23232325
\pnum
@@ -2328,19 +2330,19 @@
23282330
literal \placeholder{L} is treated as a call
23292331
of the form
23302332
\begin{codeblock}
2331-
operator "" @\placeholder{X}@(@\placeholder{ch}{}@)
2333+
operator ""@\placeholder{X}@(@\placeholder{ch}{}@)
23322334
\end{codeblock}
23332335

23342336
\pnum
23352337
\begin{example}
23362338
\begin{codeblock}
2337-
long double operator "" _w(long double);
2338-
std::string operator "" _w(const char16_t*, std::size_t);
2339-
unsigned operator "" _w(const char*);
2339+
long double operator ""_w(long double);
2340+
std::string operator ""_w(const char16_t*, std::size_t);
2341+
unsigned operator ""_w(const char*);
23402342
int main() {
2341-
1.2_w; // calls \tcode{operator "" _w(1.2L)}
2342-
u"one"_w; // calls \tcode{operator "" _w(u"one", 3)}
2343-
12_w; // calls \tcode{operator "" _w("12")}
2343+
1.2_w; // calls \tcode{operator ""_w(1.2L)}
2344+
u"one"_w; // calls \tcode{operator ""_w(u"one", 3)}
2345+
12_w; // calls \tcode{operator ""_w("12")}
23442346
"two"_w; // error: no applicable literal operator
23452347
}
23462348
\end{codeblock}

source/lib-intro.tex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3154,6 +3154,10 @@
31543154

31553155
\pnum
31563156
Literal suffix identifiers\iref{over.literal} that do not start with an underscore are reserved for future standardization.
3157+
Literal suffix identifiers that contain a double underscore
3158+
\tcode{\unun}
3159+
\indextext{character!underscore}%
3160+
are reserved for use by \Cpp{} implementations.
31573161

31583162
\rSec3[alt.headers]{Headers}
31593163

source/overloading.tex

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3934,6 +3934,7 @@
39343934
The \grammarterm{ud-suffix} of the \grammarterm{user-defined-string-literal} or
39353935
the \grammarterm{identifier} in a \grammarterm{literal-operator-id} is called a
39363936
\defnx{literal suffix identifier}{literal!suffix identifier}.
3937+
The first form of \grammarterm{literal-operator-id} is deprecated.
39373938
Some literal suffix identifiers are reserved for future standardization;
39383939
see~\ref{usrlit.suffix}. A declaration whose \grammarterm{literal-operator-id} uses
39393940
such a literal suffix identifier is ill-formed, no diagnostic required.
@@ -4008,19 +4009,19 @@
40084009
\pnum
40094010
\begin{example}
40104011
\begin{codeblock}
4011-
void operator "" _km(long double); // OK
4012-
string operator "" _i18n(const char*, std::size_t); // OK
4013-
template <char...> double operator "" _\u03C0(); // OK, UCN for lowercase pi
4012+
void operator ""_km(long double); // OK
4013+
string operator "" _i18n(const char*, std::size_t); // OK, deprecated
4014+
template <char...> double operator ""_\u03C0(); // OK, UCN for lowercase pi
40144015
float operator ""_e(const char*); // OK
40154016
float operator ""E(const char*); // ill-formed, no diagnostic required:
40164017
// reserved literal suffix\iref{usrlit.suffix,lex.ext}
40174018
double operator""_Bq(long double); // OK, does not use the reserved \grammarterm{identifier} \tcode{_Bq}\iref{lex.name}
40184019
double operator"" _Bq(long double); // ill-formed, no diagnostic required:
40194020
// uses the reserved \grammarterm{identifier} \tcode{_Bq}\iref{lex.name}
4020-
float operator " " B(const char*); // error: non-empty \grammarterm{string-literal}
4021-
string operator "" 5X(const char*, std::size_t); // error: invalid literal suffix identifier
4022-
double operator "" _miles(double); // error: invalid \grammarterm{parameter-declaration-clause}
4023-
template <char...> int operator "" _j(const char*); // error: invalid \grammarterm{parameter-declaration-clause}
4024-
extern "C" void operator "" _m(long double); // error: C language linkage
4021+
float operator " "B(const char*); // error: non-empty \grammarterm{string-literal}
4022+
string operator ""5X(const char*, std::size_t); // error: invalid literal suffix identifier
4023+
double operator ""_miles(double); // error: invalid \grammarterm{parameter-declaration-clause}
4024+
template <char...> int operator ""_j(const char*); // error: invalid \grammarterm{parameter-declaration-clause}
4025+
extern "C" void operator ""_m(long double); // error: C language linkage
40254026
\end{codeblock}
40264027
\end{example}

0 commit comments

Comments
 (0)