This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin 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: Is it a valid C++ structure initialization?


On Wed, Nov 27, 2002 at 06:57:59PM -0500, Christopher Faylor wrote:
>On Mon, Nov 25, 2002 at 06:50:10PM -0500, Sergey Okhapkin wrote:
>>Here is a test program (wich seems to me incorrect):
>>
>>struct asd {
>> int a;
>> char b;
>>};
>>
>>void f(int i, char c)
>>{
>> struct asd qwe = {
>>  a: i,
>>  b: c
>> };
>>
>>}
>>
>>The program compiles fine with gcc-3.2. Gcc 3.3 current snapshot reports:
>>test.cc: In function `void f(int, char)':
>>test.cc:11: error: too many initializers for `asd'
>
>Yes, they are incorrect.  They are using gcc extensions which are no longer
>supported in g++ apparently.  Even the C99 labelled initializers are not
>supported.
>
>So, we have to fix these.

Actually, on closer inspection, I'm not so sure.  I made a simple change
to gcc which seems to allow these and since the error is so strange I'm
wondering if this is really allowd.  I also found some warnings in g++
which seem to indicated that labeled initializers are allowed.

I think I'll inquire of the gcc mailing list.

cgf


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