From: Iain Sandoe Date: Thu, 30 Jan 2025 08:19:21 +0000 (+0000) Subject: c++: Update const_decl handling after r15-7259 [PR118673]. X-Git-Tag: releases/gcc-14.3.0~451 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19bf2732ae4ad0c37c2493e82cc500724de746a8;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc index b37d4605e06..abed2ce859c 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 */