This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

erroneous error -- inconsistent application of const



Relevant information:

  This bug involves the following EGCS release

  egcs-2.90.23 980102 (egcs-1.0.1 release)

  compiled with just configure and make.  egcs was built with gcc
  2.7.2.1.


Irrelevant information:

  My system is a vanilla RedHat 4.2 with nearly all patches available
  from RedHat.


Problem:

Try compiling this file (a.cc)

   class A
   {
     public:
       static void f(char const * const * const argv);
   };

   void f(char const * const * const argv);

   void g()
   {
       char** a;
       A::f(a);
       f(a);
   }

with the command g++ -pedantic -c a.cc


You get the error

   a.cc: In function `void g()':
   a.cc:13: no matching function for call to `A::f (char **&)'
   a.cc:5: candidates are: A::f(const char *const *) <near match>

Note that it doesn't care about the global f; it just cares about the
f inside of A.  My understanding is that neither is wrong, but it is
certainly a bug that the compiler complains about one without
complaining about the other.

The last time I looked at a draft standard (actually, the ARM, with
revisions from April, 1995), "const" could be applied as many times as
necessary to function arguments....

--
E. Jay Berkenbilt (ejb@ql.org)  |  Member, League for Programming Freedom
http://www.ql.org/q/            |  lpf@uunet.uu.net, http://www.lpf.org  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]