public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Is this valid c++ ?
@ 2009-04-30 22:48 Albert Hopkins
  0 siblings, 0 replies; only message in thread
From: Albert Hopkins @ 2009-04-30 22:48 UTC (permalink / raw)
  To: gcc

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.





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-30 19:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-30 22:48 Is this valid c++ ? Albert Hopkins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).