[PATCH] Fix IRGen for referencing a static local before emitting its decl

Richard Smith richard at metafoo.co.uk
Thu Aug 7 11:05:04 PDT 2014


Hmm, I think you need to emit a definition, not just a declaration, when you see the first use of a static local variable. Here's a valid C++1y program that I think the current patch would reject (with a link error):

  static auto f() {
    static int n;
    struct S { int &operator()() { return n; } };
    return S();
  }
  
  int main() { return decltype(f())()(); }

http://reviews.llvm.org/D4787






More information about the cfe-commits mailing list