www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - const char* const* problem

↑ ↓ ← 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
↑ ↓ 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
↑ ↓ → 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