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 electronics |
c++ - bug: strange namespace bug
This has come up in the development of a new library - flecxx; zero-cost flexibility for standard libraries - that I'm hoping to 0.1-launch this month. DMC++ is the only compiler that has any kind of problems with what I'm trying to do. Hopefully the bug is something very simple, and a fix can be effected reasonably quickly. The problem manifests even with one level of namespace (dmc_ns_bug_small.cpp); I've submitted both because it's imperative for flecxx that the two-level one (dmc_ns_bug.cpp) works. Compilation of the "small" version gives: P:\Programs\dm\Libraries\STL\STLport-4.5\stlport\stlport\stl/_istream.h(221) : Error: namespace 'ns1' does not enclose member '?0' of namespace 'std' P:\Programs\dm\Libraries\STL\STLport-4.5\stlport\stlport\stl/_istream.h(222) : Error: undefined identifier 'ios_base' P:\Programs\dm\Libraries\STL\STLport-4.5\stlport\stlport\stl/_istream.h(228) : Error: namespace 'ns1' does not enclose member '?0' of namespace 'std' P:\Programs\dm\Libraries\STL\STLport-4.5\stlport\stlport\stl/_istream.h(231) : Error: namespace 'ns1' does not enclose member '?1' of namespace 'std' P:\Programs\dm\Libraries\STL\STLport-4.5\stlport\stlport\stl/_istream.h(233) : Error: namespace 'ns1' does not enclose member '?B_N' of namespace 'std ' Fatal error: too many errors --- errorlevel 1 Compilation of the two-level version gives: P:\Programs\dm\Libraries\STL\STLport-4.5\stlport\stlport\stl/_istream.h(221) : Error: namespace 'ns2' does not enclose member '?0' of namespace 'std' P:\Programs\dm\Libraries\STL\STLport-4.5\stlport\stlport\stl/_istream.h(222) : Error: undefined identifier 'ios_base' P:\Programs\dm\Libraries\STL\STLport-4.5\stlport\stlport\stl/_istream.h(228) : Error: namespace 'ns2' does not enclose member '?0' of namespace 'std' P:\Programs\dm\Libraries\STL\STLport-4.5\stlport\stlport\stl/_istream.h(231) : Error: namespace 'ns2' does not enclose member '?1' of namespace 'std' P:\Programs\dm\Libraries\STL\STLport-4.5\stlport\stlport\stl/_istream.h(233) : Error: namespace 'ns2' does not enclose member '?B_N' of namespace 'std ' Fatal error: too many errors --- errorlevel 1 Cheers Matt Nov 04 2007
I had a similar problem. The only solution I found, was to declare the class that used the std::* outside the namespace, then inherit or typedef it inside the namespace, for example: #include <fstream> template< typename C, typename T > class basic_fstream_outside : public ::std::basic_fstream<C, T>{}; namespace ns1 { template< typename C , typename T > class basic_fstream : public ::basic_fstream_outside<C, T> {}; typedef ::ns1::basic_fstream<char, ::std::char_traits<char> > fstream; } // namespace ns1 void main() { ns1::fstream stm; } ___________________________ I didn't test this out with fstream, rather the problem occurred with std::map. std::string did not have this problem. Dec 02 2007
Any news on this? I'm about to launch flecxx in next week or so, and it'd be nice not to have to #error on DMC++ for some of the components. Cheers Matt "Matthew Wilson" <matthew hat.stlsoft.dot.org> wrote in message news:fgl6jq$2mia$1 digitalmars.com...This has come up in the development of a new library - flecxx; zero-cost flexibility for standard libraries - that I'm hoping to 0.1-launch this month. DMC++ is the only compiler that has any kind of problems with what I'm trying to do. Hopefully the bug is something very simple, and a fix Dec 25 2007
|