Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 93 additions & 73 deletions source/meta.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4072,17 +4072,6 @@
Otherwise, \tcode{r} represents a variable;
a reflection of the object declared by that variable.
\end{itemize}
\begin{example}
\begin{codeblock}
int x;
int& y = x;

static_assert(^^x != ^^y); // OK, \tcode{r} and \tcode{y} are different variables so their
// reflections compare different
static_assert(object_of(^^x) == object_of(^^y)); // OK, because \tcode{y} is a reference
// to \tcode{x}, their underlying objects are the same
\end{codeblock}
\end{example}

\pnum
\throws
Expand All @@ -4102,6 +4091,19 @@
currently under evaluation.
\end{itemize}
\end{itemize}

\pnum
\begin{example}
\begin{codeblock}
int x;
int& y = x;

static_assert(^^x != ^^y); // OK, \tcode{r} and \tcode{y} are different variables so their
// reflections compare different
static_assert(object_of(^^x) == object_of(^^y)); // OK, because \tcode{y} is a reference
// to \tcode{x}, their underlying objects are the same
\end{codeblock}
\end{example}
\end{itemdescr}

\indexlibraryglobal{constant_of}%
Expand All @@ -4126,6 +4128,15 @@
return reflect_constant([: @$R$@ :]);
}
\end{codeblock}

\pnum
\throws
\tcode{meta::exception} unless
either \tcode{r} represents an annotation or
\tcode{[: $R$ :]} is a valid
\grammarterm{splice-expression}\iref{expr.prim.splice}.

\pnum
\begin{example}
\begin{codeblock}
constexpr int x = 0;
Expand Down Expand Up @@ -4155,13 +4166,6 @@
constexpr info r = constant_of(fn()); // error: \tcode{x} is outside its lifetime
\end{codeblock}
\end{example}

\pnum
\throws
\tcode{meta::exception} unless
either \tcode{r} represents an annotation or
\tcode{[: $R$ :]} is a valid
\grammarterm{splice-expression}\iref{expr.prim.splice}.
\end{itemdescr}

\indexlibraryglobal{is_public}%
Expand Down Expand Up @@ -4464,6 +4468,8 @@
\tcode{true} if \tcode{dealias(r)} represents a type that is enumerable
from some point in the evaluation context.
Otherwise, \tcode{false}.

\pnum
\begin{example}
\begin{codeblock}
class S;
Expand Down Expand Up @@ -4864,6 +4870,13 @@
Otherwise, \tcode{\reflexpr{$E$}}.
\end{itemize}
\end{itemize}

\pnum
\throws
\tcode{meta::exception} unless
\tcode{has_parent(r)} is \tcode{true}.

\pnum
\begin{example}
\begin{codeblock}
struct I { };
Expand All @@ -4887,11 +4900,6 @@
static_assert(parent_of(^^F::A) == ^^F::N);
\end{codeblock}
\end{example}

\pnum
\throws
\tcode{meta::exception} unless
\tcode{has_parent(r)} is \tcode{true}.
\end{itemdescr}

\indexlibraryglobal{dealias}%
Expand All @@ -4903,6 +4911,13 @@
\pnum
\returns
A reflection representing the underlying entity of what \tcode{r} represents.

\pnum
\throws
\tcode{meta::exception} unless
\tcode{r} represents an entity.

\pnum
\begin{example}
\begin{codeblock}
using X = int;
Expand All @@ -4912,11 +4927,6 @@
static_assert(dealias(^^Y) == ^^int);
\end{codeblock}
\end{example}

\pnum
\throws
\tcode{meta::exception} unless
\tcode{r} represents an entity.
\end{itemdescr}

\indexlibraryglobal{has_template_arguments}%
Expand Down Expand Up @@ -4994,6 +5004,13 @@
Otherwise, $R$ is a reflection representing the value of $A$.
\end{itemize}
\end{itemize}

\pnum
\throws
\tcode{meta::exception} unless
\tcode{has_template_arguments(r)} is \tcode{true}.

\pnum
\begin{example}
\begin{codeblock}
template<class T, class U = T> struct Pair { };
Expand All @@ -5019,11 +5036,6 @@
static_assert(template_arguments_of(T)[3] == ^^PairPtr);
\end{codeblock}
\end{example}

\pnum
\throws
\tcode{meta::exception} unless
\tcode{has_template_arguments(r)} is \tcode{true}.
\end{itemdescr}

\indexlibraryglobal{parameters_of}%
Expand Down Expand Up @@ -5243,6 +5255,16 @@
is \tcode{\exposid{ctx-scope}($S$)},
where $S$ is the immediate scope of \tcode{\exposid{eval-point}($P$)}
and $P$ is the point at which the invocation of \tcode{current} lexically appears.

\pnum
\remarks
\tcode{current} is not an addressable function\iref{namespace.std}.
An invocation of \tcode{current} that appears at a program point $P$
is value-dependent\iref{temp.dep.constexpr}
if \tcode{\exposid{eval-point}\brk{}(\brk{}$P$)} is enclosed by a scope
corresponding to a templated entity.

\pnum
\begin{example}
\begin{codeblock}
struct A {
Expand Down Expand Up @@ -5284,14 +5306,6 @@
}
\end{codeblock}
\end{example}

\pnum
\remarks
\tcode{current} is not an addressable function\iref{namespace.std}.
An invocation of \tcode{current} that appears at a program point $P$
is value-dependent\iref{temp.dep.constexpr}
if \tcode{\exposid{eval-point}\brk{}(\brk{}$P$)} is enclosed by a scope
corresponding to a templated entity.
\end{itemdescr}

\begin{itemdecl}
Expand Down Expand Up @@ -5411,6 +5425,20 @@
The definitions of when a class member or base class is accessible from a point $P$
do not consider whether a declaration of that entity is reachable from $P$.
\end{note}

\pnum
\throws
\tcode{meta::exception} if
\begin{itemize}
\item
\tcode{r} represents a class member
for which \tcode{\exposid{PARENT-CLS}(r)} is an incomplete class or
\item
\tcode{r} represents a direct base class relationship $(D, B)$
for which $D$ is incomplete.
\end{itemize}

\pnum
\begin{example}
\begin{codeblock}
consteval access_context fn() {
Expand All @@ -5429,18 +5457,6 @@
static_assert(is_accessible(Cls::r, access_context::unchecked())); // OK
\end{codeblock}
\end{example}

\pnum
\throws
\tcode{meta::exception} if
\begin{itemize}
\item
\tcode{r} represents a class member
for which \tcode{\exposid{PARENT-CLS}(r)} is an incomplete class or
\item
\tcode{r} represents a direct base class relationship $(D, B)$
for which $D$ is incomplete.
\end{itemize}
\end{itemdescr}

\indexlibraryglobal{has_inaccessible_nonstatic_data_members}%
Expand Down Expand Up @@ -5605,6 +5621,15 @@
Implicitly-declared special members
appear after any user-declared members\iref{special}.
\end{note}

\pnum
\throws
\tcode{meta::exception} unless
\tcode{dealias(r)} is a reflection representing either
a class type that is complete from some point in the evaluation context
or a namespace.

\pnum
\begin{example}
\begin{codeblock}
// TU1
Expand Down Expand Up @@ -5639,13 +5664,6 @@
// representing \tcode{S::I}
\end{codeblock}
\end{example}

\pnum
\throws
\tcode{meta::exception} unless
\tcode{dealias(r)} is a reflection representing either
a class type that is complete from some point in the evaluation context
or a namespace.
\end{itemdescr}

\indexlibraryglobal{bases_of}%
Expand Down Expand Up @@ -5969,6 +5987,21 @@
\begin{note}
The order in which two annotations appear is otherwise unspecified.
\end{note}

\pnum
\throws
\tcode{meta::exception} unless
\tcode{item} represents a
type,
type alias,
variable,
function,
namespace,
enumerator,
direct base class relationship, or
non-static data member.

\pnum
\begin{example}
\begin{codeblock}
[[=1]] void f();
Expand Down Expand Up @@ -6003,19 +6036,6 @@
static_assert(annotations_of(^^x)[0] == annotations_of(^^y)[0]);
\end{codeblock}
\end{example}

\pnum
\throws
\tcode{meta::exception} unless
\tcode{item} represents a
type,
type alias,
variable,
function,
namespace,
enumerator,
direct base class relationship, or
non-static data member.
\end{itemdescr}

\indexlibraryglobal{annotations_of_with_type}%
Expand Down