Skip to content

Commit 6e578b6

Browse files
authored
Merge 2019-07 CWG Motion 3
P1331R2 Permitting trivial default initialization in constexpr contexts Fixes #2982.
2 parents a207869 + 4e54a60 commit 6e578b6

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

source/declarations.tex

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -828,8 +828,7 @@
828828
\item an identifier label\iref{stmt.label},
829829
\item a definition of a variable
830830
of non-literal type or
831-
of static or thread storage duration or
832-
for which no initialization is performed.
831+
of static or thread storage duration.
833832
\end{itemize}
834833
\begin{note}
835834
A \grammarterm{function-body} that is \tcode{= delete} or \tcode{= default}
@@ -853,8 +852,8 @@
853852
return value;
854853
}
855854
constexpr int uninit() {
856-
int a; // error: variable is uninitialized
857-
return a;
855+
struct { int a; } s;
856+
return s.a; // error: uninitialized read of \tcode{s.a}
858857
}
859858
constexpr int prev(int x)
860859
{ return --x; } // OK
@@ -886,10 +885,6 @@
886885
shall satisfy the requirements for a \grammarterm{function-body} of a
887886
constexpr function;
888887

889-
\item
890-
every non-variant non-static data member and base class subobject
891-
shall be initialized\iref{class.base.init};
892-
893888
\item
894889
if the class is a union having variant members\iref{class.union}, exactly one of them
895890
shall be initialized;

source/expressions.tex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6935,6 +6935,10 @@
69356935
that is applied to a glvalue
69366936
that refers to a non-active member of a union or a subobject thereof;
69376937

6938+
\item
6939+
an lvalue-to-rvalue conversion that is applied to
6940+
an object with an indeterminate value\iref{basic.indet};
6941+
69386942
\item
69396943
an invocation of an implicitly-defined copy/move constructor or
69406944
copy/move assignment operator

source/preprocessor.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1684,7 +1684,7 @@
16841684
\defnxname{cpp_capture_star_this} & \tcode{201603L} \\ \rowsep
16851685
\defnxname{cpp_char8_t} & \tcode{201811L} \\ \rowsep
16861686
\defnxname{cpp_conditional_explicit} & \tcode{201806L} \\ \rowsep
1687-
\defnxname{cpp_constexpr} & \tcode{201603L} \\ \rowsep
1687+
\defnxname{cpp_constexpr} & \tcode{201907L} \\ \rowsep
16881688
\defnxname{cpp_coroutines} & \tcode{201902L} \\ \rowsep
16891689
\defnxname{cpp_decltype} & \tcode{200707L} \\ \rowsep
16901690
\defnxname{cpp_decltype_auto} & \tcode{201304L} \\ \rowsep

0 commit comments

Comments
 (0)