<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Thanks for bringing this up Richard!</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"></div><div class="gmail_extra">we reject the corresponding non-template case</div></div></blockquote><div><br></div><div>It looks like we <b>correctly</b> reject the non-template case. The GCC folks ran into that case and declared it invalid: <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51080">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51080</a>.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">but accept the corresponding non-local class template case.</div></div></blockquote><div><br></div><div>In terms of standardese, I haven't dug deep enough to determine whether this case is valid or not. Perhaps you know the answer to this already?</div><div><br></div><div>In terms of our implementation, given that the non-template case is ill-formed:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">struct X {<br>    static constexpr int get() { return 42; } </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">    int arr[get()];  // ill-formed: get() not defined here.<br>};  // get() is defined here.</blockquote><div><br></div><div>It makes sense to me that the following would not work either:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">void f() { </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">  struct X {<br>    static constexpr int get() { return 42; }<br>    int arr[get()];<br>  }<br>}</blockquote><div><br></div><div>Given that the class template case works (again, not sure about the standardese):</div><div> <br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">template <typename></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">struct X { </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">    static constexpr int get() { return 42; } </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">    int arr[get()]; </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">}; </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">template class X<void>;</blockquote></div><div><br></div><div>I think the following should work also:</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">template <typename></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">void f() {</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">  struct X {<br>    static constexpr int get() { return 42; }<br>    int arr[get()];<br>  }<br>}</blockquote><div> </div></div><div><div>I think we need to distinguish the 2 cases (1) a local class enclosed in a non-template function and (2) a local class enclosed in a function template. A local class within a non-template function would behave similarly to a non-template class whereas a local class within a function template would behave similarly to a class template. Currently we seem to treat a local class similar to a non-template class whether it's enclosed in a non-template function or a function template.</div></div></div></div></div>