>From 647b752f90910fc9d7fbaaf482dc5a7a936dc875 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <i...@sandoe.co.uk>
Date: Sat, 15 Mar 2025 10:04:52 +0000
Subject: [PATCH] cobol: Avoid a use of auto.

Tested on x86_64 linux/darwin and aarch64 linux, OK for trunk?
thanks
Iain

--- 8< ---

In this case the deduction for Darwin's implementation is 'char *' which
then conflicts with the second use of data.initial in the find_if callback.
Let's just specify it as 'const char *'.

gcc/cobol/ChangeLog:

        * util.cc (cbl_field_t::report_invalid_initial_value): Avoid
        auto here and specify const char *.

Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>
---
 gcc/cobol/util.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc
index ecef10190eb..dd7449fd85f 100644
--- a/gcc/cobol/util.cc
+++ b/gcc/cobol/util.cc
@@ -859,7 +859,7 @@ cbl_field_t::report_invalid_initial_value(const YYLTYPE& 
loc) const {
         /*
          * Check fraction for excess precision
          */
-        auto p = strchr(data.initial, symbol_decimal_point());
+        const char *p = strchr(data.initial, symbol_decimal_point());
         if( p ) {
           auto pend = std::find(p, p + strlen(p), 0x20);
           int n = std::count_if( ++p, pend, isdigit );
-- 
2.39.2 (Apple Git-143)

Reply via email to