On Fri, Apr 24, 2015 at 1:24 PM, Michael Park <[email protected]> wrote:

> This patch instantiates the pending local instantiations earlier in order
> to enable to following code to compile:
>
>   template <typename T>
>   void F() {
>     struct Num {
>       static constexpr int Get() { return 42; }
>     };
>     constexpr int n = Num::Get();
>   }
>
>   int main() {
>     F<int>();
>   }
>
> This addresses PR20625.
>

Hmm. This approach still rejects this:

template<typename T> void f() {
  struct X {
    static constexpr int get() { return 42; }
    int arr[get()];
  };
}
template void f<int>();

I'm OK with that; we reject the corresponding non-template case, but accept
the corresponding non-local class template case.

LGTM
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to