Skip to content

Commit 4d80df0

Browse files
authored
[libc++] Do not forward-declare syncstream outside experimental (#82511)
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.
1 parent 6fd27d5 commit 4d80df0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

libcxx/include/iosfwd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ typedef fpos<mbstate_t> u8streampos;
142142
typedef fpos<mbstate_t> u16streampos;
143143
typedef fpos<mbstate_t> u32streampos;
144144

145-
#if _LIBCPP_STD_VER >= 20
145+
#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
146146

147147
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>
148148
class basic_syncbuf;
@@ -160,7 +160,7 @@ using osyncstream = basic_osyncstream<char>;
160160
using wosyncstream = basic_osyncstream<wchar_t>;
161161
# endif
162162

163-
#endif // _LIBCPP_STD_VER >=20
163+
#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
164164

165165
// Include other forward declarations here
166166
template <class _Tp, class _Alloc = allocator<_Tp> >

libcxx/modules/std/iosfwd.inc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,23 @@ export namespace std {
1818
using std::u8streampos;
1919
#endif
2020

21+
#ifndef _LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM
2122
using std::basic_osyncstream;
2223
using std::basic_syncbuf;
24+
#endif
2325

2426
using std::istreambuf_iterator;
2527
using std::ostreambuf_iterator;
2628

29+
#ifndef _LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM
2730
using std::osyncstream;
2831
using std::syncbuf;
2932

30-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
33+
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
3134
using std::wosyncstream;
3235
using std::wsyncbuf;
33-
#endif
36+
# endif
37+
#endif // _LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM
3438

3539
using std::fpos;
3640
} // namespace std

0 commit comments

Comments
 (0)