Sheng Zhou
2009-Apr-24 03:33 UTC
[LLVMdev] llvm-g++ doesnt support class member initialization of arrays of constants
Here is the example code: class A { const int x[5]; public: //A() { x[0] = 1; x[1] = 1; x[2] = 2; x[3] = 3; x[4] = 4; } A():x((const int[5]){1,2,3,4,5}) {} int getV(int idx) { return x[idx];} }; //const int A::x[5] = { 1, 2, 3, 4, 5 }; int main() { A a; return a.getV(1); } gcc 4.1.2 can compile the above code. llvm-gcc reports: x.cpp: In constructor \u2018A::A()\u2019: x.cpp:5: error: array used as initializer am i missing something? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090424/af775476/attachment.html>
Eli Friedman
2009-Apr-24 05:18 UTC
[LLVMdev] llvm-g++ doesnt support class member initialization of arrays of constants
On Thu, Apr 23, 2009 at 8:33 PM, Sheng Zhou <zhousheng00 at gmail.com> wrote:> gcc 4.1.2 can compile the above code. > llvm-gcc reports: > x.cpp: In constructor \u2018A::A()\u2019: > x.cpp:5: error: array used as initializer > > am i missing something?It's a change in gcc, not LLVM; gcc 4.3 prints out the same error. -Eli
Possibly Parallel Threads
- [LLVMdev] llvm-gcc not compatible with gcc on a small case?
- Compiling samba4 hangs at [1815/3978] Compiling librpc/ndr/ndr_basic.c
- compiling buoh comic reader for C-6
- [LLVMdev] Fw: llvm-gcc not compatible with gcc on a small case?
- Sieve regexp matches wrong