www.digitalmars.com         C & C++   DMDScript  

c++ - const char* const* problem

reply Sanel <Sanel_member pathlink.com> writes:
Hello,
i have strange problem with overloading function that accept const char* const*
and char* const* arguments. Here is sample:

void func(const char* const* D)
{
printf("%s\n", D[0]);
}

void func(char* const *D)
{
func((const char* const*)D);
}

int main()
{
char * D[]={"bla", "bla2"};
func(D);
return 0;
}

When i try to compile it i got :

func((const char* const*)D);	                           ^

const.cpp(13) : Error: ambiguous reference to symbol
Had: func(char const *const *)
and: func(char *const *)
func(D);
^
const.cpp(19) : Error: ambiguous reference to symbol
Had: func(char const *const *)
and: func(char *const *)
--- errorlevel 1

Hm, strange; but when i place:
void func(char* const D[]) or
void func(const char* const D[])

compilation pass.
It seems that compiler can't distiguish bettwen const char* const* and 
char* const* types. Other compilers (gcc, vc, borlandc++) support this.

I tested with 8.38 and 8.41

Solutions (except casting) ?


Thanks.
Sanel 
Sep 27 2004
parent reply Scott Michel <scottm mordred.cs.ucla.edu> writes:
Sanel <Sanel_member pathlink.com> wrote:
 Hello,
 i have strange problem with overloading function that accept const char* const*
 and char* const* arguments. Here is sample:
Known bug, reported bug, awaiting fix (except mine is with void, not char). -scooter
Sep 28 2004
parent Sanel <Sanel_member pathlink.com> writes:
Thanks. 
Hope fix come soon.

Sanel

In article <cjcork$306p$1 digitaldaemon.com>, Scott Michel says...
Sanel <Sanel_member pathlink.com> wrote:
 Hello,
 i have strange problem with overloading function that accept const char* const*
 and char* const* arguments. Here is sample:
Known bug, reported bug, awaiting fix (except mine is with void, not char). -scooter
Sep 29 2004