This is the mail archive of the gcc@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]
Other format: [Raw text]

Is this valid c++ ?


I have the following code snippet:

typedef volatile struct {
} mystruct;

void mytest(mystruct* x) {};

As a C program (gcc) this compiles fine, but with g++ I get the
following error:

test.cpp:4: error: non-local function âvoid mytest(volatile mystruct*)â
uses anonymous type
test.cpp:2: error: âtypedef volatile struct<anonymous> mystructâ does
not refer to the unqualified type, so it is not used for linkage

So my question is: is g++ reporting the error incorrectly, or is it not
valid c++ and if so why?

Thanks in advance.






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