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);


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);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to