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

commit r15-7288-gc5667a1ee31518b1cd576c2f8e186d88bbf13f58
Author: Iain Sandoe <i...@sandoe.co.uk>
Date:   Wed Jan 29 11:59:14 2025 +0000

    c++: Update const_decl handling after r15-7259 [PR118673].
    
    Objective-C++ uses CONST_DECLs to hold constant string objects
    these should also be treated as mergable lvalues.
    
            PR c++/118673
    
    gcc/cp/ChangeLog:
    
            * tree.cc (lvalue_kind): Mark CONST_DECLs as mergable
            when they are also TREE_STATIC.
    
    Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>

Diff:
---
 gcc/cp/tree.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
index fb6b2b18e94f..79bc74fa2b7a 100644
--- a/gcc/cp/tree.cc
+++ b/gcc/cp/tree.cc
@@ -213,7 +213,7 @@ lvalue_kind (const_tree ref)
          && DECL_IN_AGGR_P (ref))
        return clk_none;
 
-      if (DECL_MERGEABLE (ref))
+      if (TREE_CODE (ref) == CONST_DECL || DECL_MERGEABLE (ref))
        return clk_ordinary | clk_mergeable;
 
       /* FALLTHRU */

Reply via email to