0

I'm struggling to understand why this happen, maybe it's a bug.

#include <thread>
#include <cstdio>
using namespace std;

int main(){
    int y=2;
    float fa[2][y]; // thread compile fine if y were 2 hardcoded instead
    fa[0][0]=0.8;
    fa[0][1]=1.8;
    auto fx=[&](){
        for(int c=0;c<2;c++){ // thread compile fine if c<2 were c<1 instead
            printf("\n%f",fa[0][c]); // (1*) "internal compiler error: in expand_expr_real_1, at expr.c:9327"
        }
    };
    fx(); // works fine everytime
    thread(fx).join(); //error (1*)
}

Why it compile only if changing on how I commented it?

I'm using gcc 4.8.0 with winpthreads.

superbem
  • 441
  • 3
  • 10
  • Well... the issue appears to be a strange combination of C++ Variable length arrays (which are NOT standards conformant, but are a g++ extension) and lambdas. This in turn leads to an internal g++ compiler error, which is likely a bug in g++, since one would expect that they would support this use. – Dave S May 25 '13 at 02:35
  • Thanks. I reported [here](http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57408) – superbem May 25 '13 at 15:15

0 Answers0