[libcxx-commits] [libcxx] 2479b3d - [libc++] Fix filesystem test in C++11/14

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 27 08:23:01 PDT 2020


Author: Louis Dionne
Date: 2020-10-27T11:21:33-04:00
New Revision: 2479b3d7c6f87a3aeb150cb02b0c39e428d0b8bc

URL: https://github.com/llvm/llvm-project/commit/2479b3d7c6f87a3aeb150cb02b0c39e428d0b8bc
DIFF: https://github.com/llvm/llvm-project/commit/2479b3d7c6f87a3aeb150cb02b0c39e428d0b8bc.diff

LOG: [libc++] Fix filesystem test in C++11/14

Before C++17, std::string::data() was marked as const, so we can't use
it to write to the contents of the string.

Added: 
    

Modified: 
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp
index c2bc237954f2..dd38b1e45f0a 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp
@@ -76,7 +76,7 @@ TEST_CASE(large_file) {
     std::FILE* dest_file = std::fopen(dest.string().c_str(), "rb");
     TEST_REQUIRE(dest_file != nullptr);
     TEST_REQUIRE(std::fseek(dest_file, sendfile_size_limit, SEEK_SET) == 0);
-    TEST_REQUIRE(std::fread(out_data.data(), sizeof(out_data[0]), additional_size, dest_file) == additional_size);
+    TEST_REQUIRE(std::fread(&out_data[0], sizeof(out_data[0]), additional_size, dest_file) == additional_size);
     std::fclose(dest_file);
   }
   TEST_CHECK(out_data.size() == additional_data.size());


        


More information about the libcxx-commits mailing list