diff options
author | David L. Jones <dlj@google.com> | 2017-01-09 21:38:07 +0000 |
---|---|---|
committer | David L. Jones <dlj@google.com> | 2017-01-09 21:38:07 +0000 |
commit | f55ce36c029dd68577743179884ed43d76697937 (patch) | |
tree | 8da157b6088c19aea80cc9162a38a781520a1c6f /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | a84ab073d968415eab0c44d6e695bd2072f4c027 (diff) | |
download | bcm5719-llvm-f55ce36c029dd68577743179884ed43d76697937.tar.gz bcm5719-llvm-f55ce36c029dd68577743179884ed43d76697937.zip |
Allow constexpr construction of subobjects unconditionally, not just in C++14.
Summary:
Per https://wg21.link/CWG1677, the C++11 standard did not clarify that constant
initialization of an object allowed constexpr brace-or-equal initialization of
subobjects:
struct foo_t { union { int i; volatile int j; } u; };
__attribute__((__require_constant_initialization__))
static const foo_t x = {{0}};
Because foo_t::u has a volatile member, the initializer for x fails. However,
there is really no good reason, because this:
union foo_u { int i; volatile int j; };
__attribute__((__require_constant_initialization__))
static const foo_u x = {0};
does have a constant initializer.
(This was triggered by musl's pthread_mutex_t type when building under C++11.)
Reviewers: rsmith
Subscribers: EricWF, cfe-commits
Differential Revision: https://reviews.llvm.org/D28427
llvm-svn: 291480
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
0 files changed, 0 insertions, 0 deletions