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

Braden Ganetsky via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 1 20:48:14 PDT 2026


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

See #195466 for explanation.

>From 9403ad2aafec4d1da4f74c7d8dc10d62e4b4385e Mon Sep 17 00:00:00 2001
From: Braden Ganetsky <braden.ganetsky at gmail.com>
Date: Mon, 1 Jun 2026 22:36:43 -0500
Subject: [PATCH] [libc++] Make the body of println(FILE*) dependent on the
 template parameter to avoid template instantiation

---
 libcxx/include/print | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcxx/include/print b/libcxx/include/print
index cfa844e6ab607..90e3f63f529c7 100644
--- a/libcxx/include/print
+++ b/libcxx/include/print
@@ -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");
 }
 
 template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).



More information about the libcxx-commits mailing list