C++ PATCH for libstdc++/48760 (list-initialization of complex)

Jason Merrill jason@redhat.com
Thu Apr 28 01:51:00 GMT 2011


In the discussion of 48760, Gaby suggested that we allow 
list-initialization of built-in complex numbers.  This made a lot of 
sense to me, so I've gone ahead and implemented it.

Basically it works as though complex were an aggregate except for one 
thing: for backwards compatibility, we never assume elided braces when 
initializing a complex number.  So given

struct A
{
   _Complex int c;
   int i;
};

A a = { 1, 2 };

a.c is initialized to 1+0i rather than 1+2i as it has been previously, 
and a.i is initialized to 2.

Tested x86_64-pc-linux-gnu, applying to trunk.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 48760.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110428/dce12b93/attachment.ksh>


More information about the Gcc-patches mailing list