On 09/11/2012 08:57 PM, Maxim Fomin wrote:
I think it is UB rather than a bug.
No, this is a bug.
The spec says that return types must match exactly.
Exactly. If it was UB, the spec would say the behaviour is undefined if they don't match exactly.
AFAIK auto is a feature to infer return type, not to magically adjust to multiple incompatible types.