c++ - bug: strange namespace bug
- Matthew Wilson (60/60) Nov 04 2007 This has come up in the development of a new library - flecxx; zero-cost
- A. Fasten (23/23) Dec 02 2007 I had a similar problem. The only solution I found, was to declare the c...
- Matthew Wilson (17/45) Dec 25 2007 Any news on this? I'm about to launch flecxx in next week or so, and it'...
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 begin 666 dmc_ns_bug_small.zip M;"YC<'!=4$T+PR ,O0O^A\ N&Q3*KJYXZ5_HO:1JF:!.JAV,TO^^VKJ/-KDD ML>76XXJXXU!L6JELXX ZAG7, 0-DWBHV0UG"X>4IGP\MP:)VY\OW*U:KO+S( M)X&9DC=02P$"% `4````" !P,V4WVXQ:7;0```!/`0``% `````````!`" ` MMH$`````9&UC7VYS7V)U9U]S;6%L;"YC<'!02P4&``````$``0!"````Y `` ` end begin 666 dmc_ns_bug.zip M4,$*PC ,O1?Z#P M;)PW=5]9R"X4.HN-ED(*CXVE%HT%3ZD4PSIS>&5 BF";ML9 ,\:/UC(+\KGV MCN2S=H83*$6A4LI<L2M"ARY0ENMU3_R:&HF 1'*FB/86GH*V+VMGWGHK6I8G MY C[/7R=]">7,E.*^\U5T*#S 8<'!02P4&``````$``0`\`````0$````` ` end
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 fixcanbe 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
Dec 25 2007