llvm-project/clang/test/CXX
David L. Jones f55ce36c02 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
2017-01-09 21:38:07 +00:00
..
basic Allow constexpr construction of subobjects unconditionally, not just in C++14. 2017-01-09 21:38:07 +00:00
class Fix all tests under test/CXX (and test/Analysis) to pass if clang's default 2016-08-31 23:24:08 +00:00
class.access Fix all tests under test/CXX (and test/Analysis) to pass if clang's default 2016-08-31 23:24:08 +00:00
class.derived Move checks for creation of objects of abstract class type from the various 2016-12-15 02:28:18 +00:00
concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept [Concepts] Implement subsection [dcl.spec.concept]p7 of the Concepts TS 2016-04-09 02:55:27 +00:00
conv [c++1z] P0003R5: Removing dynamic exception specifications. 2016-12-08 02:49:07 +00:00
cpp/cpp.predefined P0035R4: add predefined __STDCPP_DEFAULT_NEW_ALIGNMENT__ macro. By default, we 2016-09-30 22:41:36 +00:00
dcl.dcl PR30305: Implement proposed DR resolution to prevent slicing via inherited constructor. 2017-01-08 21:45:44 +00:00
dcl.decl [c++1z] P0217R3: Allow by-value structured binding of arrays. 2016-12-14 03:22:16 +00:00
drs Implement C++ DR1391 (wg21.link/cwg1391) 2017-01-09 08:01:21 +00:00
except P0012R1: Make exception specifications be part of the type system. This 2016-10-16 17:54:23 +00:00
expr PR23135: Don't instantiate constexpr functions referenced in unevaluated operands where possible. 2017-01-07 00:48:55 +00:00
lex Convert test/CXX/lex/lex.literal/lex.string/p4.cpp back to DOS line 2016-01-04 10:17:48 +00:00
over Add a note that points to the linkage specifier for the C++ linkage errors 2016-11-02 15:46:34 +00:00
special Cleanup the handling of noinline function attributes, -fno-inline, 2016-12-23 01:24:49 +00:00
stmt.stmt Try contextually converting condition of constexpr if to Boolean value 2016-09-07 18:24:54 +00:00
temp Implement DR1388 (wg21.link/cwg1388). 2017-01-09 07:14:40 +00:00