This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Labeled initializer elements mishandled
- To: egcs at cygnus dot com
- Subject: Labeled initializer elements mishandled
- From: Andreas Schwab <schwab at issan dot informatik dot uni-dortmund dot de>
- Date: 29 Dec 1997 11:25:02 +0100
The C++ compiler mishandles labeled elements in initializers, ie. it
effectively ignores the labels.
$ cat init.cc
struct X { int a, b; };
struct X f (int a, int b)
{
struct X y = { b: b, a: a };
return y;
}
int main ()
{
struct X x = f (42, 0);
if (x.a != 42 || x.b != 0)
abort ();
exit (0);
}
$ gcc init.cc
$ ./a.out
Aborted (core dumped)
--
Andreas Schwab "And now for something
schwab@issan.informatik.uni-dortmund.de completely different"
schwab@gnu.org