This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Is this valid c++ ?
- From: Albert Hopkins <marduk at letterboxes dot org>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 30 Apr 2009 15:43:34 -0400
- Subject: 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.