[libcxx-commits] [libcxx] [libc++] Do not forward-declare syncstream outside experimental (PR #82511)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 21 09:29:54 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

<details>
<summary>Changes</summary>

We only define the classes in <syncstream> when experimental library features are enabled, but we would forward-declare them in <iosfwd> even when they are disabled. This led to confusing error messages about being unable to instantiate an undefined template.

---
Full diff: https://github.com/llvm/llvm-project/pull/82511.diff


1 Files Affected:

- (modified) libcxx/include/iosfwd (+2-2) 


``````````diff
diff --git a/libcxx/include/iosfwd b/libcxx/include/iosfwd
index e28998d004156d..728700853fb331 100644
--- a/libcxx/include/iosfwd
+++ b/libcxx/include/iosfwd
@@ -143,7 +143,7 @@ typedef fpos<mbstate_t> u8streampos;
 typedef fpos<mbstate_t> u16streampos;
 typedef fpos<mbstate_t> u32streampos;
 
-#if _LIBCPP_STD_VER >= 20
+#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
 
 template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>
 class basic_syncbuf;
@@ -161,7 +161,7 @@ using osyncstream = basic_osyncstream<char>;
 using wosyncstream = basic_osyncstream<wchar_t>;
 #  endif
 
-#endif // _LIBCPP_STD_VER >=20
+#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
 
 // Include other forward declarations here
 template <class _Tp, class _Alloc = allocator<_Tp> >

``````````

</details>


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


More information about the libcxx-commits mailing list