Skip to content

Commit

Permalink
c++: Avoid using __array_rank as a variable name [PR115061]
Browse files Browse the repository at this point in the history
This patch fixes a compilation error when building GCC using Clang.
Since __array_rank is used as a built-in trait name, use rank instead.

	PR c++/115061

gcc/cp/ChangeLog:

	* semantics.cc (finish_trait_expr): Use rank instead of
	__array_rank.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
(cherry picked from commit 30ff6c5)
  • Loading branch information
ken-matsui authored and iains committed May 14, 2024
1 parent d00f13b commit 3763ff8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gcc/cp/semantics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12914,10 +12914,10 @@ finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2)
tree val;
if (kind == CPTK_RANK)
{
size_t __array_rank = 0;
size_t rank = 0;
for (; TREE_CODE (type1) == ARRAY_TYPE; type1 = TREE_TYPE (type1))
++__array_rank;
val = build_int_cst (size_type_node, __array_rank);
++rank;
val = build_int_cst (size_type_node, rank);
}
else
val = (trait_expr_value (kind, type1, type2)
Expand Down

0 comments on commit 3763ff8

Please sign in to comment.