www.digitalmars.com         C & C++   DMDScript  

c++ - BUG: typedef not visible for friend?

reply Roland Pibinger <rpbg123 yahoo.com> writes:
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
parent Roland Pibinger <rpbg123 yahoo.com> writes:
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