Suspected C++ implementation error (ofstream.open())

Problem description:
A call to ofstream.open(“name.txt”) when name.txt is a file that doesn’t exist does not create said file and instead appears to throw std::invalid_argument(“stod”)

Expected behavior:
According to the standards, ofstream.open() should create a file with the filename it is passed if said file does not exist.

Actual behavior:
Replit’s implementation appears to throw std::invalid_argument(“stod”). I know because I had a try catch block intended to catch a different std::invalid_argument and print .what() and I got stod printed at that point in the program.

Steps to reproduce:
Write something like the following code (with appropriate includes):

try {
  std::ofstream outFile;
  outFile.open("name.txt"); // name.txt doesn't exist.
} catch (std::invalid_argument e) {
  std::cout << e.what() << lineNumber << '\n'; // lineNumber is a standin 
                                               // for the actual line number
}

Bug appears at this link:
Private repl, so no link. (It’s out of my control).

Browser: Chrome
OS: Windows 11
Device (Android, iOS, NA leave blank): NA
Desktop app version (Avatar menu->“Version”) or NA: NA
Plan (Free, Replit Core): Free

Hey @ThomasWarenski!

Could you perhaps send a Loom or at least any screenshots of the Console? This could help the team in debugging the bug further.

Thanks!

Line 41 is the caller’s catch block location.

P.S. That was FAST!