On 03/27/2013 12:33 PM, kenji hara wrote:
2013/3/27 Timon Gehr <[email protected] <mailto:[email protected]>>Because of a questionable patch (written by Kenji Hara, I think) some time ago, the following works: struct S{ template T(int x){ auto s = x; // implicitly static } } I consider this bad language design. In above case, 's' cannot make a field in S. Because such a feature would make impossible to determine the size of S.
Obviously.
... So, variables in template declaration will always make "static' variables. ...
Non-static variables should just be disallowed, as they are in the 'const' case. Implicitly adding static does not reduce confusion.
Furthermore, it would be ok to template function-local variables, a nice future extension that is blocked by this design.
