// This file tests the clang extension which allows initializing the components
// of a complex number individually using an initialization list. Basically,
// if you have an explicit init list for a complex number that contains two
// initializers, this extension kicks in to turn it into component-wise
// initialization.
//
// This extension is useful because there isn't any way to accurately build
// a complex number at the moment besides setting the components with
// __real__ and __imag__, which is inconvenient and not usable for constants.
// (Of course, there are other extensions we could implement that would
// allow this, like some sort of __builtin_build_complex.)
//
// FIXME: It would be a good idea to have a warnings for implicit
// real->complex and complex->real conversions; as-is, it's way too easy
// to get implicit conversions when they are not intended.
// Basic testcase
_Complexfloatvalid1={1.0f,2.0f};// expected-warning {{specifying real and imaginary components is an extension}}
// Struct for nesting tests
structteststruct{_Complexfloatx;};
// Random other valid stuff
_Complexintvalid2={1,2};// expected-warning {{complex integer}} expected-warning {{specifying real and imaginary components is an extension}}
structteststructvalid3={{1.0f,2.0f}};// expected-warning {{specifying real and imaginary components is an extension}}
_Complexfloatvalid4[2]={{1.0f,1.0f},{1.0f,1.0f}};// expected-warning 2 {{specifying real and imaginary components is an extension}}
// FIXME: We need some sort of warning for valid5
_Complexfloatvalid5={1.0f,1.0fi};// expected-warning {{imaginary constants}} expected-warning {{specifying real and imaginary components is an extension}}