[libcxx-commits] [libcxx] [libc++] Make the body of println(FILE*) dependent on the template parameter to avoid template instantiation (PR #200996)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 1 21:07:09 PDT 2026


================
@@ -338,9 +338,9 @@ println(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, format_string<_Args...> __fmt,
 #    endif // _LIBCPP_HAS_UNICODE
 }
 
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
+template <class _Tp = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE inline void println(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream) {
-  std::print(__stream, "\n");
+  std::print(static_cast<decltype(_Tp(), __stream)>(__stream), "\n");
----------------
frederick-vs-ja wrote:

Can we use `(_Tp)std::print(__stream, "\n");`?

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


More information about the libcxx-commits mailing list