https://gcc.gnu.org/g:a43cd560e4383774a7cfa5b0d4f29f7f5ec70fc1

commit r17-4044-ga43cd560e4383774a7cfa5b0d4f29f7f5ec70fc1
Author: Sammy Al Hashemi <[email protected]>
Date:   Wed Sep 9 09:06:31 2026 -0600

    libstdc++: Make make_decimalN inline instead of static [PR122071]
    
    The make_decimal32/64/128 overloads in <decimal/decimal.h> were declared
    static at namespace scope, which gives them internal linkage.  An entity
    with internal linkage cannot be exported, so these functions are not
    usable from modules when the header is consumed as a header unit or
    included in a module purview.  Internal linkage also means every
    translation unit including the header gets its own copy of each
    function, each with a distinct address.
    
    Declaring them inline instead gives them external linkage with
    vague-linkage semantics: a single entity shared across translation
    units, which can be exported.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/122071
            * include/decimal/decimal.h (make_decimal32): Make inline
            instead of static.
            (make_decimal64): Likewise.
            (make_decimal128): Likewise.
    
    Signed-off-by: Sammy Al Hashemi <[email protected]>

Diff:
---
 libstdc++-v3/include/decimal/decimal.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libstdc++-v3/include/decimal/decimal.h 
b/libstdc++-v3/include/decimal/decimal.h
index f18fbffa83ba..37d17ba4d681 100644
--- a/libstdc++-v3/include/decimal/decimal.h
+++ b/libstdc++-v3/include/decimal/decimal.h
@@ -120,7 +120,7 @@ namespace decimal
 
   // ISO/IEC TR 24733  3.2.5  Initialization from coefficient and exponent.
 
-  static decimal32 make_decimal32(long long __coeff, int __exponent)
+  inline decimal32 make_decimal32(long long __coeff, int __exponent)
   {
     decimal32 __decexp = 1, __multiplier;
 
@@ -138,7 +138,7 @@ namespace decimal
     return __coeff * __decexp;
   }
 
-  static decimal32 make_decimal32(unsigned long long __coeff, int __exponent)
+  inline decimal32 make_decimal32(unsigned long long __coeff, int __exponent)
   {
     decimal32 __decexp = 1, __multiplier;
 
@@ -156,7 +156,7 @@ namespace decimal
     return __coeff * __decexp;
   }
 
-  static decimal64 make_decimal64(long long __coeff, int __exponent)
+  inline decimal64 make_decimal64(long long __coeff, int __exponent)
   {
     decimal64 __decexp = 1, __multiplier;
 
@@ -174,7 +174,7 @@ namespace decimal
     return __coeff * __decexp;
   }
 
-  static decimal64 make_decimal64(unsigned long long __coeff, int __exponent)
+  inline decimal64 make_decimal64(unsigned long long __coeff, int __exponent)
   {
     decimal64 __decexp = 1, __multiplier;
 
@@ -192,7 +192,7 @@ namespace decimal
     return __coeff * __decexp;
   }
 
-  static decimal128 make_decimal128(long long __coeff, int __exponent)
+  inline decimal128 make_decimal128(long long __coeff, int __exponent)
   {
     decimal128 __decexp = 1, __multiplier;
 
@@ -210,7 +210,7 @@ namespace decimal
     return __coeff * __decexp;
   }
 
-  static decimal128 make_decimal128(unsigned long long __coeff, int __exponent)
+  inline decimal128 make_decimal128(unsigned long long __coeff, int __exponent)
   {
     decimal128 __decexp = 1, __multiplier;

Reply via email to