[libcxx-commits] [libcxx] AIX fopen() does not support the 'x' (exclusive/noreplace) mode suffix. (PR #206498)

Jake Egan via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 3 09:45:00 PDT 2026


================
@@ -745,9 +744,13 @@ basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::open(const wchar
   if (__file_)
     return nullptr;
   const wchar_t* __mdstr = __make_mdwstring(__mode);
-  if (!__mdstr)
+  if (!__mdstr) {
+#      if defined(_AIX) || defined(__TOS_AIX__)
+    if (__mode & ios_base::noreplace)
+      fprintf(stderr, "warning: fstream::open() with noreplace is not supported on AIX; returning failure\n");
----------------
jakeegan wrote:

Can you use `_LIBCPP_DIAGNOSE_WARNING` instead? And then verify the warning in the test.

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


More information about the libcxx-commits mailing list