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]

Re: anonymous structures within a union do not compile by c++ compiler


Alex Babkin wrote:
the following code compiles if the source file uses .c extension with the usual "gcc -o out source.c" command but would not compie if i rename the file to .cpp extension.

The C and C++ front ends are separate. Sometimes language extensions get added to one but not the other. This appears to be the situation in this case. The extension is in the C front end, but not the C++ front end.


There may also be C++ language issues that prevent this working in C++.

If you try using -pedantic, you will get warnings. This shows that the testcase is using GNU C language extensions.

You could try submitting a bug report asking for the same extension to be added to the C++ front end.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



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