g++ bug in dllexport (on windows)

Marat Boshernitsan maratb@CS.Berkeley.EDU
Mon Apr 24 02:27:00 GMT 2000


The following snippet of code causes an "interesting" error message on
win32:

---- cut ----

#define DLLIMPORT __attribute__(( dllexport )) 

class DLLIMPORT NODE {
  class DLLIMPORT Property {
    friend class NODE;
  };
};

class DLLIMPORT UltraRoot : public NODE {
public:
  void UltraRoot::tree_size (const NODE *node = __null) const {
    const NODE *tmp = node ? node : this;
  }
};

---- cut ----

compiling with "g++ -c -o bug.o bug.cc" yields:

bug.cc:12: type `const NODE' is not a base type for type `const NODE'
bug.cc:12: type `const NODE' is not a base type for type `const UltraRoot'

Doesn't make much sense, does it?

Undefining DLLIMPORT fixes the error.

Removing "friend class NODE" fixes the error.

The compiler is "gcc version 2.95.2 19991024 (release)" on
"CYGWIN_NT-4.0 DOGWOOD 1.1.0(0.17/3/2) 2000-03-01 00:15:19 i686 unknown"

(For obvious reasons, I can't test this on Unix).

Any thoughts?  Workarounds?

Thanks in advance!

Marat Boshernitsan.




More information about the Gcc mailing list