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: typedef not visible for friend?
The following code compiles with current compilers (Comeau C/C++ 4.3.9, VS 8.0) but produces an error with DMC (which may or may not be a bug): operating system: Win2000 compiler: DMC v849 class A { public: static bool foo () { return true; } }; class B { typedef A AClass; public: friend bool exec1 (const B& b) { return A::foo(); } // ok friend bool exec2 (const B& b) { return AClass::foo(); } // error in line 11 }; int main() { B b; exec1 (b); exec2 (b); } dmc_bug.cpp(11) : Error: undefined identifier 'AClass' Best regards, Roland Pibinger May 04 2007
DMC seems to have a general problem with friend functions. Another example: class C { static void foo() {} public: friend void bar(const C& c) { foo(); } // error }; dmc_bug.cpp(17) : Error: undefined identifier 'foo' May 05 2007
|