Index: test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp =================================================================== --- test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp +++ test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp @@ -27,9 +27,13 @@ } { std::ifstream fs("test.dat", std::ios_base::out); - double x = 0; - fs >> x; - assert(x == 3.25); + + if (fs) // "test.dat" might be read-only. + { // See also: test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp + double x = 0; + fs >> x; + assert(x == 3.25); + } } { std::wifstream fs("test.dat"); @@ -39,8 +43,12 @@ } { std::wifstream fs("test.dat", std::ios_base::out); - double x = 0; - fs >> x; - assert(x == 3.25); + + if (fs) // "test.dat" might be read-only. + { // See also: test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp + double x = 0; + fs >> x; + assert(x == 3.25); + } } } Index: test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp =================================================================== --- test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp +++ test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp @@ -27,9 +27,13 @@ } { std::ifstream fs(std::string("test.dat"), std::ios_base::out); - double x = 0; - fs >> x; - assert(x == 3.25); + + if (fs) // "test.dat" might be read-only. + { // See also: test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp + double x = 0; + fs >> x; + assert(x == 3.25); + } } { std::wifstream fs(std::string("test.dat")); @@ -39,8 +43,12 @@ } { std::wifstream fs(std::string("test.dat"), std::ios_base::out); - double x = 0; - fs >> x; - assert(x == 3.25); + + if (fs) // "test.dat" might be read-only. + { // See also: test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp + double x = 0; + fs >> x; + assert(x == 3.25); + } } } Index: test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp =================================================================== --- test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp +++ test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp @@ -31,6 +31,12 @@ fs >> x; assert(x == 3.25); } + { + std::ifstream fs(temp.c_str(), std::ios_base::out); + double x = 0; + fs >> x; + assert(x == 3.25); + } std::remove(temp.c_str()); { std::wofstream fs(temp.c_str()); @@ -42,5 +48,11 @@ fs >> x; assert(x == 3.25); } + { + std::wifstream fs(temp.c_str(), std::ios_base::out); + double x = 0; + fs >> x; + assert(x == 3.25); + } std::remove(temp.c_str()); } Index: test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp =================================================================== --- test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp +++ test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp @@ -31,6 +31,12 @@ fs >> x; assert(x == 3.25); } + { + std::ifstream fs(temp, std::ios_base::out); + double x = 0; + fs >> x; + assert(x == 3.25); + } std::remove(temp.c_str()); { std::wofstream fs(temp); @@ -42,5 +48,11 @@ fs >> x; assert(x == 3.25); } + { + std::wifstream fs(temp, std::ios_base::out); + double x = 0; + fs >> x; + assert(x == 3.25); + } std::remove(temp.c_str()); }