Skip to content

Commit e623bbe

Browse files
committed
P2996R13 Reflection for C++26
1 parent 2e12f5e commit e623bbe

File tree

6 files changed

+3515
-14
lines changed

6 files changed

+3515
-14
lines changed

source/compatibility.tex

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,22 @@
2828
Valid \CppXXIII{} code using \keyword{contract_assert} as an identifier
2929
is not valid in this revision of \Cpp{}.
3030

31+
\diffref{lex.operators}
32+
\change
33+
New operator \tcode{^^}.
34+
\rationale
35+
Required for new features.
36+
\effect
37+
Valid \CppXXIII{} that contains two consecutive \tcode{^} tokens
38+
can be ill-formed in this revision of \Cpp{}.
39+
\begin{example}
40+
\begin{codeblock}
41+
struct C { int operator^(int); };
42+
int operator^(int (C::*p)(int), C);
43+
int i = &C::operator^^C{}; // ill-formed; previously well-formed
44+
\end{codeblock}
45+
\end{example}
46+
3147
\rSec2[diff.cpp23.expr]{\ref{expr}: expressions}
3248

3349
\diffref{expr.arith.conv}
@@ -148,6 +164,23 @@
148164
\end{codeblock}
149165
\end{example}
150166

167+
\diffref{dcl.attr.grammar}
168+
\change
169+
New token \tcode{:]}.
170+
\rationale
171+
Required for new features.
172+
\effect
173+
Valid \CppXXIII{} that contained an \grammarterm{attribute-specifier}
174+
with an \grammarterm{attribute-using-prefix}
175+
but no attributes and no whitespace
176+
is ill-formed in this revision of \Cpp{}.
177+
\begin{example}
178+
\begin{codeblock}
179+
struct [[using CC:]] C; // ill-formed; previously well-formed
180+
struct [[using DD: ]] D; // OK
181+
\end{codeblock}
182+
\end{example}
183+
151184
\rSec2[diff.cpp23.temp]{\ref{temp}: templates}
152185

153186
\diffref{temp.constr}
@@ -221,6 +254,8 @@
221254
\libheaderref{hive},
222255
\libheaderrefx{inplace_vector}{inplace.vector.syn},
223256
\libheaderref{linalg},
257+
%FIXME: \libheaderref{meta} after renaming to meta.syn
258+
\libheaderrefx{meta}{meta.type.synop},
224259
\libheaderref{rcu},
225260
\libheaderref{simd},
226261
\libheaderref{stdbit.h},

source/lib-intro.tex

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,11 @@
368368
and also define the function as deleted.
369369
\end{example}
370370

371+
\item
372+
\constantwhen
373+
the conditions that are required for a call to the function
374+
to be a constant subexpression\iref{defns.const.subexpr}.
375+
371376
\item
372377
\expects
373378
conditions that the function assumes to hold whenever it is called;
@@ -454,6 +459,7 @@
454459
Next, the semantics of the code sequence are determined by the
455460
\Fundescx{Constraints},
456461
\Fundescx{Mandates},
462+
\Fundescx{Constant When},
457463
\Fundescx{Preconditions},
458464
\Fundescx{Hardened preconditions},
459465
\Fundescx{Effects},
@@ -1248,6 +1254,7 @@
12481254
\tcode{<mdspan>} \\
12491255
\tcode{<memory>} \\
12501256
\tcode{<memory_resource>} \\
1257+
\tcode{<meta>} \\
12511258
\tcode{<mutex>} \\
12521259
\columnbreak
12531260
\tcode{<new>} \\
@@ -3082,6 +3089,26 @@
30823089
either a standard library non-static member function\iref{member.functions}
30833090
or an instantiation of a standard library member function template.
30843091

3092+
\pnum
3093+
Let \tcode{\placeholder{F}} denote
3094+
a standard library function or function template.
3095+
Unless \tcode{\placeholder{F}} is designated an addressable function,
3096+
it is unspecified if or how
3097+
a reflection value designating the associated entity can be formed.
3098+
%FIXME: Why is this not an example, but a note that begins with "For example"?
3099+
\begin{note}
3100+
For example, it is possible that \tcode{std::meta::members_of}
3101+
will not return reflections of standard library functions
3102+
that an implementation handles through an extra-linguistic mechanism.
3103+
\end{note}
3104+
3105+
\pnum
3106+
Let \tcode{\placeholder{F}} denote
3107+
a standard library class or class template specialization.
3108+
It is unspecified if or how
3109+
a reflection value can be formed to any private member of \tcode{\placeholder{F}},
3110+
or what the names of such members may be.
3111+
30853112
\pnum
30863113
A translation unit shall not declare namespace \tcode{std} to be an inline namespace\iref{namespace.def}.
30873114

source/macros.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@
363363
\newcommand{\required}{\Fundesc{Required behavior}}
364364
\newcommand{\constraints}{\Fundesc{Constraints}}
365365
\newcommand{\mandates}{\Fundesc{Mandates}}
366+
\newcommand{\constantwhen}{\Fundesc{Constant When}}
366367
\newcommand{\expects}{\Fundesc{Preconditions}}
367368
\newcommand{\hardexpects}{\Fundesc{Hardened preconditions}}
368369
\newcommand{\effects}{\Fundesc{Effects}}

0 commit comments

Comments
 (0)