[gcc r16-9324] libstdc++: Correct export checks for _GLIBCXX_EXTERN_TEMPLATE

Tomasz Kaminski tkaminsk@gcc.gnu.org
Tue Jul 21 07:55:34 GMT 2026


https://gcc.gnu.org/g:59da5d2ebe58e136d79342ad3631ff027cf20bf3

commit r16-9324-g59da5d2ebe58e136d79342ad3631ff027cf20bf3
Author: Tomasz Kamiński <tkaminsk@redhat.com>
Date:   Tue Jun 23 19:12:01 2026 +0200

    libstdc++: Correct export checks for _GLIBCXX_EXTERN_TEMPLATE
    
    Replace a basic_string specific _GLIBCXX_EXTERN_TEMPLATE > 0 with
    simple check for _GLIBCXX_EXTERN_TEMPLATE. This make sure that
    extern definition is also use for -O0 (default).
    Exported declarations are also important for future extensibility,
    as they always pick latest implementation.
    
    libstdc++-v3/ChangeLog:
    
            * include/std/format (__do_vformat_to): Change the preprocessor
            check for __do_vformat_to.
    
    Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
    Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
    (cherry picked from commit 6ac3a6c8aa22dc78f68eb3c99e2c600ca3e57904)

Diff:
---
 libstdc++-v3/include/std/format | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index f5577087f710..9cce822378d2 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -5299,7 +5299,7 @@ namespace __format
 // instantiates formatters for types stored in basic_format_arg, we can
 // support only single encoding, in this case unicode. This should cover
 // most common use cases.
-#if __cplusplus <= 202002L && _GLIBCXX_EXTERN_TEMPLATE > 0
+#if __cplusplus <= 202002L && _GLIBCXX_EXTERN_TEMPLATE
     extern template _Sink_iter<char>
       __do_vformat_to<char, 1>(_Sink_iter<char>, string_view,
 			       format_context&);


More information about the Libstdc++-cvs mailing list