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

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 1 20:49:09 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Braden Ganetsky (k3DW)

<details>
<summary>Changes</summary>

See #<!-- -->195466 for explanation.

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


1 Files Affected:

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


``````````diff
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).

``````````

</details>


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


More information about the libcxx-commits mailing list