| Thread overview |
|---|
April 17, 2002 namespaces and -Error: ambiguous reference to symbol | ||||
|---|---|---|---|---|
| ||||
Similar to what STLport does to pull global functions into std::
//test.cpp - test namespace
//global function
void testfunc(void){}
//pull into namespace
namespace myname{
using ::testfunc;
};
//use in namespace
namespace myname{
void func(void){
testfunc(); // Error: ambiguous reference to symbol
}
};
int main(void){
myname::func();
return 1;
};
output:
>sc test.cpp
test3
testfunc(); //Error: ambiguous reference to symbol
^
test.cpp(13) : Error: ambiguous reference to symbol
Had: testfunc()
and: testfunc()
--- errorlevel 1
>Exit code: 1
Borland compiles cleanly.
>bcc32 test.cpp
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
test.cpp:
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
>Exit code: 0
| ||||
April 17, 2002 Re: namespaces and -Error: ambiguous reference to symbol | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Tom Lowe | DMC doesn't do the so-called "Koenig lookup" on namespaces. It will, but until then, probably the easiest thing is to use the STL included with DMC. "Tom Lowe" <talowe@tmynetplus.com> wrote in message news:a9inco$1acd$2@digitaldaemon.com... > Similar to what STLport does to pull global functions into std:: > > //test.cpp - test namespace > //global function > void testfunc(void){} > > //pull into namespace > namespace myname{ > using ::testfunc; > }; > > > //use in namespace > namespace myname{ > void func(void){ > testfunc(); // Error: ambiguous reference to symbol > } > }; > > int main(void){ > myname::func(); > return 1; > }; > > output: > > >sc test.cpp > test3 > testfunc(); //Error: ambiguous reference to symbol > ^ > test.cpp(13) : Error: ambiguous reference to symbol > Had: testfunc() > and: testfunc() > --- errorlevel 1 > >Exit code: 1 > > Borland compiles cleanly. > > >bcc32 test.cpp > Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland > test.cpp: > Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland > >Exit code: 0 > > > | |||
April 17, 2002 Re: namespaces and -Error: ambiguous reference to symbol | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:a9j2vh$2h7f$1@digitaldaemon.com... > DMC doesn't do the so-called "Koenig lookup" on namespaces. It will, but until then, probably the easiest thing is to use the STL included with DMC. Was hoping I could use stlport to pull standard functions into std::, just have to wait. Thanks for the reply Tom Lowe talowe@mynetplus.com | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply