[libcxx-commits] [libcxx] Reapply "[libc++] Optimize fstream::read" (PR #206453)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 2 01:47:56 PDT 2026
================
@@ -68,6 +68,25 @@ int main(int, char**) {
test_buffer.resize(24);
assert(std::string(test_buffer.data(), 24) == "to test buffer behaviour");
}
+ { // Ensure that read fails gracefully with an unopened ifstream
+ // See https://llvm.org/PR168628
+ char buf[10];
+ std::ifstream ifs;
+
+ assert(!ifs.is_open());
+ assert(!ifs.bad());
+ assert(!ifs.fail());
+ assert(!ifs.eof());
+ assert(ifs.good());
+
+ ifs.read(buf, sizeof(buf));
----------------
philnik777 wrote:
I've decided to use the streambuf interface instead, since that's what this test actually cares about.
https://github.com/llvm/llvm-project/pull/206453
More information about the libcxx-commits
mailing list