Doc No: | N2713 = 08-0223 |
Date: | 2008-08-04 |
Reply to: | Bill Seymour <stdbill.h@pobox.com> |
One national body disliked allowing
Because of this controversy, the current version of the initializer paper, N2712, retains the “static”.In order to determine the layout of X, we now have 2-phase name lookup and ADL. Note that func could be either a type or a function; it may be found in T, the namespace of MyType, the associated namespace(s) of T when instantiated, the global namespace, an anonymous namespace, or any namespaces subject to a using directive. With care we could probably throw some concept_map lookup in for luck.template< class T > struct MyType : T { auto data = func(); static const size_t erm = sizeof(data); };Depending on the order of header inclusion I might even get different results for ADL, and break the One Definition Rule - which is not required to be diagnosed.
Recently, it was pointed out on comp.lang.c++.moderated that one can get the same effect anyway, just with uglier code, using decltype. Because of that, the author believes that the objection to auto has softened.
This paper suggests deleting the “static”. If N2712 is not accepted for C++0X, this paper is moot.
Delete “static” from paragraph 4:
The auto type-specifier can also be used in declaring an object in the condition of a selection statement (6.4) or an iteration statement (6.5), in the type-specifier-seq in a new-type-id (5.3.4), and in declaring astaticdata member with abrace-or-equal-initializer that appears within themember-specification of a class definition (9.4.2).