]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: Update const_decl handling after r15-7259 [PR118673].
authorIain Sandoe <iains.gcc@gmail.com>
Thu, 30 Jan 2025 08:19:21 +0000 (08:19 +0000)
committerJason Merrill <jason@redhat.com>
Thu, 27 Feb 2025 10:34:09 +0000 (05:34 -0500)
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 <iain@sandoe.co.uk>
gcc/cp/tree.cc

index b37d4605e06c2081cefc3d80138e43b9394d759b..abed2ce859c7ec755727251c0954d980739eda5b 100644 (file)
@@ -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 */