[LLVMdev] llvm-g++ doesnt support class member initialization of arrays of constants

Sheng Zhou zhousheng00 at gmail.com
Thu Apr 23 20:33:43 PDT 2009


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>


More information about the llvm-dev mailing list