C++11で導入されたauto型指定子(type-specifier)による宣言において、複数の変数を一括宣言する場合にはそれぞれから同じ型へ推論できないとill-formedとなる。
auto x1 = 3.14, x2 = 42; // NG: 前者はdouble, 後者はint auto y1 = 3.14, y2 = 42.; // OK
gcc 4.7.2でのエラー出力例:
error: inconsistent deduction for 'auto': 'double' and then 'int'
C++11(N3337) 7.1.6.4/p7より引用。
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
Uis not the same in each deduction, the program is ill-formed.
関連URL