It's probably not the latest, but my C++0x draft standard from June 2008 says you can do the following:
auto x = 5; // OK: x has type int
const auto *v = &x, u = 6; // OK: v has type const int*, u has type const int
So unless something has changed from June this is (or will be) permitted in a limited form with a pretty intuitive interpretation.
The limitation is that if you do want to string multiple auto declarations like this (using the example above), it works because the inferred type of
u have the same 'base type' (int in this case) to use an inexact term.
If you want the precise rule, The draft standard says this:
If the list of declarators contains more than one declarator, the type of each declared variable is determined as described
above. If the type deduced for the template parameter U is not the same in each deduction, the program is ill-formed.
where the "deduced template parameter U" is determined by:
the deduced type of the parameter u in the call f(expr) of the following invented function template:
`template <class U> void f(const U& u);`
Why they've come up with this rule instead of saying something like:
auto a = 10, b = 3.f , * c = new Class();
is equivalent to:
auto a = 10;
auto b = 3.f;
auto * c = new Class();
I don't know. But I don't write compilers. Probably something to do with once you've figured out the the
auto keyword replaces, you can't change it in the same statement.
Take for example:
int x = 5;
CFoo * c = new CFoo();
auto a1 = x, b1 = c; // why should this be permitted if
int a2 = x, CFoo* b2 = c; // this is not?
In any case, I'm not a fan of putting multiple declarations on the same statement anyway.