GCC 4.3 C++ question
Benjamin Kosnik
bkoz at redhat.com
Tue Feb 12 21:42:13 UTC 2008
> class SomeClass
> {
> public:
> SomeClass();
> // more stuff...
> protected:
> typedef struct _mylist mylist_t;
> struct _mylist {
> mylist_t *next; // here
> void *dataM
> };
> };
Please note that this does not compile with gcc-4.1 or gcc-4.3. This is
not due to an update in GCC, but rather to malformed code.
%g++ -c test.cc
test.cc:12: error: expected ';' before '}' token
test.cc:12: error: expected `;' before '}' token
There is no valid "_mylist" type in scope at the typedef, so mylist_t
is invalid and it's use later shows this error.
Change to:
struct _mylist
{
_mylist *next; // NB
void *dataM;
};
typedef _mylist mylist_t;
-benjamin
More information about the fedora-devel-list
mailing list