diff options
author | Eric Fiselier <eric@efcs.ca> | 2018-02-04 02:17:02 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2018-02-04 02:17:02 +0000 |
commit | 192622dc49d3f7fe31d6512d0e85fd03fbb39a62 (patch) | |
tree | 20724db2976a3a2ce0d328306e41b8bfb3a5c496 /libcxx/test/std/containers/sequences/array/array.data | |
parent | 8d511a65aff2085eba0ad5c6699fefb1f601a0b5 (diff) | |
download | bcm5719-llvm-192622dc49d3f7fe31d6512d0e85fd03fbb39a62.tar.gz bcm5719-llvm-192622dc49d3f7fe31d6512d0e85fd03fbb39a62.zip |
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.
llvm-svn: 324185
Diffstat (limited to 'libcxx/test/std/containers/sequences/array/array.data')
-rw-r--r-- | libcxx/test/std/containers/sequences/array/array.data/data.pass.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libcxx/test/std/containers/sequences/array/array.data/data.pass.cpp b/libcxx/test/std/containers/sequences/array/array.data/data.pass.cpp index 7b510c203f8..452d6b7f3ca 100644 --- a/libcxx/test/std/containers/sequences/array/array.data/data.pass.cpp +++ b/libcxx/test/std/containers/sequences/array/array.data/data.pass.cpp @@ -37,6 +37,14 @@ int main() (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) {} }; |