Skip to content

Commit 6a73de7

Browse files
RobertLeahytkoeppe
authored andcommitted
P2679R2 Fixing std::start_lifetime_as and std::start_lifetime_as_array
Fixes NB CA 086, US 088 (C++23 CD).
1 parent b973c47 commit 6a73de7

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

source/memory.tex

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,8 @@
881881
\begin{itemdescr}
882882
\pnum
883883
\mandates
884-
\tcode{T} is an implicit-lifetime type\iref{basic.types.general}.
884+
\tcode{T} is an implicit-lifetime type\iref{basic.types.general}
885+
and not an incomplete type\iref{term.incomplete.type}.
885886

886887
\pnum
887888
\expects
@@ -930,15 +931,34 @@
930931
\end{itemdecl}
931932

932933
\begin{itemdescr}
934+
\pnum
935+
\mandates
936+
\tcode{T} is a complete type.
937+
933938
\pnum
934939
\expects
935-
\tcode{n > 0} is \tcode{true}.
940+
\tcode{p} is suitably aligned for an array of \tcode{T} or is null.
941+
\tcode{n <= size_t(-1) / sizeof(T)} is \tcode{true}.
942+
If \tcode{n > 0} is \tcode{true},
943+
\range{(char*)p}{(char*)p + (n * sizeof(T))} denotes
944+
a region of allocated storage that is
945+
a subset of the region of storage
946+
reachable through\iref{basic.compound} \tcode{p}.
936947

937948
\pnum
938949
\effects
939-
Equivalent to:
940-
\tcode{return *start_lifetime_as<U>(p);}
950+
If \tcode{n > 0} is \tcode{true},
951+
equivalent to
952+
\tcode{start_lifetime_as<U>(p)}
941953
where \tcode{U} is the type ``array of \tcode{n} \tcode{T}''.
954+
Otherwise, there are no effects.
955+
956+
\pnum
957+
\returns
958+
A pointer to the first element of the created array,
959+
if any;
960+
otherwise,
961+
a pointer that compares equal to \tcode{p}\iref{expr.eq}.
942962
\end{itemdescr}
943963

944964
\rSec2[allocator.tag]{Allocator argument tag}

0 commit comments

Comments
 (0)