This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: typedef - bug?


> while compiling the following code with g++ error.cc
> 
> typedef struct {
>     // ...
> }*str;
> 
> void proto (str struct_ptr);
> 
> int main (void)
> {
>     return 0;
> }
> 
> i get the following message:
> error.cc:5: non-local function `void proto({anonymous struct} *)' uses
> anonymous type

This is an error in your code (which was not reported by earlier
versions). The type you define is an anonymous type (i.e. with no
linkage). You must not use such a type as a parameter to a function
with external linkage.

Hope this helps,
Martin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]