http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57408

--- Comment #3 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
Further simplification down to a library-free test case:

//------------------------------------------------------
template<typename Callable>
  struct Impl
  {
    Callable func;
    Impl(Callable f) : func(f) { }
    virtual void run() { func(); }
  };

template<typename Callable>
void call(Callable f)
  {
    Impl<Callable>(f).run();
  }

extern "C" int printf(const char*, ...);

int main(){
    int y = 2;
    float fa[2][y]; // compiles fine if y were 2 hard-coded instead
    fa[0][0]=0.8;
    fa[0][1]=1.8;
    auto fx=[&](){
        for(int c=0; c<2; c++){ // compiles fine if c<2 were c<1 instead
            printf("use me", fa[0][c]);
        }
    };
    call(fx); //error (1*)
}
//------------------------------------------------------

It seems relevant, that there is a virtual function that invokes the lambda
closure and that fa[0][c] is odr-used within the closure call expression.

Reply via email to