From e7f175f763ad432abd3ab137051bf036477578d9 Mon Sep 17 00:00:00 2001
From: Paul Russo <russo@fnal.gov>
Date: Mon, 23 Jun 2008 15:52:50 +0000
Subject: [PATCH] Fix from Philippe Canal for parsing "int* const", we should
 only make this G__PCONSTVAR if the count of pointers seen is at least one.

-- Paul Russo from Philippe Canal


git-svn-id: http://root.cern.ch/svn/root/trunk@24488 27541ba8-7e3a-0410-8455-c3a389f83636
---
 cint/cint7/src/ifunc.cxx | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/cint/cint7/src/ifunc.cxx b/cint/cint7/src/ifunc.cxx
index 39b47ce5d9d..2d031b99756 100644
--- a/cint/cint7/src/ifunc.cxx
+++ b/cint/cint7/src/ifunc.cxx
@@ -1329,7 +1329,7 @@ static int Cint::Internal::G__readansiproto(std::vector<Reflex::Type>& i_params_
       int isunsigned = 0; // unsigned seen flag and offset for type code
       // Process first keyword of type specifier (most type specifiers have only one keyword).
       {
-         // Partially handle unsigned and sigend keywords here.  Also do some integral promotions.
+         // Partially handle unsigned and signed keywords here.  Also do some integral promotions.
          if (!strcmp(buf, "unsigned") || !strcmp(buf, "signed")) {
             if (buf[0] == 'u') {
                isunsigned = -1;
@@ -1692,11 +1692,19 @@ static int Cint::Internal::G__readansiproto(std::vector<Reflex::Type>& i_params_
                   param_name[0] = c;
                   c = G__fgetstream(param_name + 1, "[=,)& \t");
                   if (!strcmp(param_name, "const")) { // handle const keyword
-                     isconst |= G__PCONSTVAR; // FIXME: This is intentionally wrong!  Fix the code that depends on this!
+                     if (ptrcnt) {
+                        isconst |= G__PCONSTVAR; // FIXME: This is intentionally wrong!  Fix the code that depends on this!
+                     } else {
+                        isconst |= G__CONSTVAR;
+                     }
                      param_name[0] = 0;
                   }
-                  if (!strcmp(param_name, "const*")) { // handle const keyword and a single pointer spec
-                     isconst |= G__CONSTVAR; // FIXME: This is intentionally wrong!  Fix the code that depends on this!
+                  else if (!strcmp(param_name, "const*")) { // handle const keyword and a single pointer spec
+                     if (ptrcnt) {
+                       isconst |= G__PCONSTVAR; // FIXME: This is intentionally wrong!  Fix the code that depends on this!
+                     } else {
+                       isconst |= G__CONSTVAR;
+                     }
                      ++ptrcnt;
                      param_name[0] = 0;
                   }
-- 
GitLab