mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-23 10:07:41 +08:00
Make array<const T, 0> non-CopyAssignable and make swap and fill ill-formed.
The standard isn't exactly clear how std::array should handle zero-sized arrays with const element types. In particular W.R.T. copy assignment, swap, and fill. This patch takes the position that those operations should be ill-formed, and makes changes to libc++ to make it so. This follows up on commit r324182. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324185 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -36,6 +36,14 @@ int main()
|
||||
T* p = c.data();
|
||||
(void)p; // to placate scan-build
|
||||
}
|
||||
{
|
||||
typedef double T;
|
||||
typedef std::array<const T, 0> C;
|
||||
C c = {};
|
||||
const T* p = c.data();
|
||||
static_assert((std::is_same<decltype(c.data()), const T*>::value), "");
|
||||
(void)p; // to placate scan-build
|
||||
}
|
||||
{
|
||||
struct NoDefault {
|
||||
NoDefault(int) {}
|
||||
|
Reference in New Issue
Block a user