<filesystem>: Set the error code for fs::absolute("", ec).#6132
Conversation
|
The error code for calling |
|
@YexuanXiao I intended to let Lines 156 to 160 in 117ca96 But libstdc++ sets the error to |
|
I like the behavior of allowing empty strings through to the Windows API and returning whatever it returns, instead of attempting to synthesize our own error code. |
|
I'm mirroring this to the MSVC-internal repo. Please notify me if any further changes are pushed, otherwise no action is required. |
|
Thanks for investigating this libcxx failure and fixing our implementation! 💾 🛠️ 🎉 |
Closes #6120
fs::absolute("", ec)was returning an emptypath, indicating an error has occurred, but didn't setecto the appropriateerror_code.libstdc++ treats this call as an error, whereas libc++ treats it as a success case.
[fs.op.absolute#1] says the function "Composes an absolute path referencing the same file system location as p according to the operating system". On Windows,
GetFullPathNameW(L"", ...)fails, so following libstdc++’s behavior is more consistent with the standard wording.This change updates the implementation to set
ec.value()to 123 (ERROR_INVALID_NAME).