May 04, 2007 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 05, 2007 Re: BUG: friend functions | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Roland Pibinger | 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'
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply