[libcxx-commits] [libcxx] [libc++][filesystem] Report an error for canonical("") (PR #215031)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Sun Aug 9 03:27:06 PDT 2026


================
@@ -128,6 +128,13 @@ Potentially breaking changes
   ``_LIBCPP_ABI_NO_ITERATOR_BASES``. If you are using this flag and care about ABI stability, you should set
   ``_LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER`` as well.
 
+- ``std::filesystem::canonical`` now reports an error (throwing ``filesystem_error``, or setting the
+  ``error_code`` for the overload that takes one) when called with an empty path, as required by
+  ``[fs.op.canonical]`` ("``!exists(p)`` is an error"), instead of silently returning the current
+  directory. ``std::filesystem::absolute``, ``std::filesystem::weakly_canonical``,
+  ``std::filesystem::relative`` and ``std::filesystem::proximate`` are unaffected and keep resolving an
+  empty path to the current directory, as required by the Standard. (`Github <https://llvm.org/PR77170>`__)
+
----------------
Zingam wrote:

I don't know if this entry in the Release Notes is necessary but putting them in the Release Notes for 22 is definitely not the right place. You should put them in 24.rst.

https://github.com/llvm/llvm-project/pull/215031


More information about the libcxx-commits mailing list