error_code not cleared in directory_entry::exists? #54
Labels
available on master
Fix is done on master branch, issue closed on next release
bug
Something isn't working
Milestone
Describe the bug
I use the class
filesystem::directory_entry
and I am checking some attributes using the methodsis_regular_file()
,is_directory()
, andexists(std::error_code &)
. For the later, I also check the content of the error_code object. In case, I reuse the samestd::error_code
object and one of the previous path is not valid, then the content of the reusedstd::error_code
object is always false (i.e. thevalue()
is not equal to 0) for the other paths even if the methodexists
returns true. Based on C++ reference, the implementation proposed by Visual Studio, or the one included in XCode 11 with macOS 10.15, theerror_code
object should be cleared. I also checked the document N4687 but it is not mentioned what to do in this case (see 30.10.12.3).To Reproduce
Expected behavior
The
std::error_code
object should be cleared if the directory entry existsAdditional context
From my comprehension of the source code, the problem is in the method
directory_entry::status(std::error_code &)
(see line 4699).In case, the status' type is not
none
, then thestd::error_code
object should be cleared. I proposed the following implementation to fix the issue.The text was updated successfully, but these errors were encountered: