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

Reid Kleckner rnk at google.com
Thu Sep 4 16:19:29 PDT 2014


>>! In D4787#4, @rsmith wrote:
> 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())()(); }

Hopefully the new patch addresses this.

http://reviews.llvm.org/D4787






More information about the cfe-commits mailing list