Re: GCC 4.3 C++ question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux