[PATCH] D27555: [libcxx] [test] Fix MSVC warning C6001 "Using uninitialized memory".
Stephan T. Lavavej via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 7 17:35:06 PST 2016
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.
[libcxx] [test] Fix MSVC warning C6001 "Using uninitialized memory".
/analyze sees array::size() being called on arrays with garbage-inited doubles,
and complains. It doesn't know that size() doesn't actually care about the
contents of the array. There's a simple way to sidestep this issue - just use
std::string, which has a default constructor.
https://reviews.llvm.org/D27555
Files:
test/std/containers/sequences/array/array.cons/default.pass.cpp
Index: test/std/containers/sequences/array/array.cons/default.pass.cpp
===================================================================
--- test/std/containers/sequences/array/array.cons/default.pass.cpp
+++ test/std/containers/sequences/array/array.cons/default.pass.cpp
@@ -12,18 +12,19 @@
// array();
#include <array>
+#include <string>
#include <cassert>
int main()
{
{
- typedef double T;
+ typedef std::string T;
typedef std::array<T, 3> C;
C c;
assert(c.size() == 3);
}
{
- typedef double T;
+ typedef std::string T;
typedef std::array<T, 0> C;
C c;
assert(c.size() == 0);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27555.80695.patch
Type: text/x-patch
Size: 689 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161208/9c7c33e0/attachment.bin>
More information about the cfe-commits
mailing list