[cfe-dev] array extended initializer lists
Richard Smith
richard at metafoo.co.uk
Tue Jul 24 12:30:14 PDT 2012
On Tue, Jul 24, 2012 at 3:19 AM, Vinxxe <vinxxe at gmail.com> wrote:
> Hi,
> is it possible, with some compiler option, to compile the following
> code with clang?
> //------------------------------------
> int main(){
>
> int x[10];
>
> x={1,2,3,4,5,6,7,8,9,0};
>
> }
> //-------------------------------------
>
If you're prepared to change the code, this is valid* C++11:
int main() {
struct { int x[10]; } s;
s = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
}
> I tried this
>
> clang -c main.cc -std=gnu++11
>
> and got the following error:
>
> main.cc:5:4: error: array type 'int [10]' is not assignable
> x={1,2,3,4,5,6,7,8,9,0};
>
You'll also need a newer Clang.
[*] According to a current discussion on CWG, and according to Clang and
GCC. Not according to the standard.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120724/8800377c/attachment.html>
More information about the cfe-dev
mailing list