This is the mail archive of the gcc@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]

Failure to convert to const char * const *



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

void g()
{
	char *ar[10];
	A a;
	f(ar);
	a.f(ar);
}
/*
specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.90.23/specs
gcc version egcs-2.90.23 980102 (egcs-1.0.1 release)

If I compile this with --pedantic, I get:

con2.C: In function `void g()':
con2.C:13: no matching function for call to `A::f (char *[10])'
con2.C:4: candidates are: A::f(const char *const *) <near match>

The call to the non-member function is fine. And it's not a warning either:
it doesn't compile. I have to cast to (const char * const *).

I've read all kinds of FAQs, but this difference between member functions
and non-member functions is new to me. IMHO it just should compile.

Regards,

Han Holl
*/


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