Archives
D Programming
DD.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++ - Error: ambiguous reference to symbol
=========================================== Digital Mars C/C++ Compiler Version 8.40.2n =========================================== DMC has a problem with the following program. ====== C++ code : File foo.cpp : BEGIN ====== #include <string> using namespace std; template <class T> int operator!=(const T& x, const T& y) { return !(x == y); } int main () { const string str; return 0; } ====== C++ code : File foo.cpp : END ======== ====== Compilation : BEGIN ====== $ dmc -I. -IC:/dm/stlport/stlport foo.cpp C:/dm/stlport/stlport\stl/_algobase.c(221) : Error: ambiguous reference to symbol Had: operator !=(const T&,const T&) and: std::operator !=(const _Tp&,const _Tp&) C:/dm/stlport/stlport\stl/_algobase.c(234) : Error: ambiguous reference to symbol Had: operator !=(const T&,const T&) and: std::operator !=(const _Tp&,const _Tp&) C:/dm/stlport/stlport\stl/_algobase.c(235) : Error: ambiguous reference to symbol Had: operator !=(const T&,const T&) and: std::operator !=(const _Tp&,const _Tp&) C:/dm/stlport/stlport\stl/_algobase.c(240) : Error: ambiguous reference to symbol Had: operator !=(const T&,const T&) and: std::operator !=(const _Tp&,const _Tp&) C:/dm/stlport/stlport\stl/_string.c(392) : Error: ambiguous reference to symbol Fatal error: too many errors --- errorlevel 1 ====== Compilation : END ======== -- Alex Vinokur mailto:alexvn connect.to http://mathforum.org/library/view/10978.html Mar 18 2004
Walter, Alex' problem might be stemming from the same issue as the one I reported in C++.beta under subject 'namespace bug?' on 2004/02/18. Kind regards, Anton Sekeris. Alex Vinokur wrote:=========================================== Digital Mars C/C++ Compiler Version 8.40.2n =========================================== DMC has a problem with the following program. ====== C++ code : File foo.cpp : BEGIN ====== #include <string> using namespace std; template <class T> int operator!=(const T& x, const T& y) { return !(x == y); } int main () { const string str; return 0; } ====== C++ code : File foo.cpp : END ======== ====== Compilation : BEGIN ====== $ dmc -I. -IC:/dm/stlport/stlport foo.cpp C:/dm/stlport/stlport\stl/_algobase.c(221) : Error: ambiguous reference to symbol Had: operator !=(const T&,const T&) and: std::operator !=(const _Tp&,const _Tp&) C:/dm/stlport/stlport\stl/_algobase.c(234) : Error: ambiguous reference to symbol Had: operator !=(const T&,const T&) and: std::operator !=(const _Tp&,const _Tp&) C:/dm/stlport/stlport\stl/_algobase.c(235) : Error: ambiguous reference to symbol Had: operator !=(const T&,const T&) and: std::operator !=(const _Tp&,const _Tp&) C:/dm/stlport/stlport\stl/_algobase.c(240) : Error: ambiguous reference to symbol Had: operator !=(const T&,const T&) and: std::operator !=(const _Tp&,const _Tp&) C:/dm/stlport/stlport\stl/_string.c(392) : Error: ambiguous reference to symbol Fatal error: too many errors --- errorlevel 1 ====== Compilation : END ======== -- Alex Vinokur mailto:alexvn connect.to http://mathforum.org/library/view/10978.html Mar 18 2004
The problem is there's a template in std which matches the template you defined in the global namespace. By bringing std's symbol table into the global namespace, then there's a conflict. This is not a bug in DMC++. "Alex Vinokur" <alexvn connect.to> wrote in message news:c3c9cn$aov$1 digitaldaemon.com...=========================================== Digital Mars C/C++ Compiler Version 8.40.2n =========================================== DMC has a problem with the following program. ====== C++ code : File foo.cpp : BEGIN ====== #include <string> using namespace std; template <class T> int operator!=(const T& x, const T& y) { return !(x == y); } int main () { const string str; return 0; } ====== C++ code : File foo.cpp : END ======== ====== Compilation : BEGIN ====== $ dmc -I. -IC:/dm/stlport/stlport foo.cpp C:/dm/stlport/stlport\stl/_algobase.c(221) : Error: ambiguous reference to Mar 18 2004
"Walter" <walter digitalmars.com> wrote in message news:c3du2o$4tn$2 digitaldaemon.com...The problem is there's a template in std which matches the template you defined in the global namespace. By bringing std's symbol table into the global namespace, then there's a conflict. This is not a bug in DMC++. Mar 18 2004
"Alex Vinokur" <alexvn connect.to> wrote in message news:c3e0io$a15$1 digitaldaemon.com..."Walter" <walter digitalmars.com> wrote in message Mar 18 2004
|