On Sun, 25 Mar 2012 12:17:10 +0200 (CEST) Marc Glisse <marc.gli...@inria.fr> wrote:
> On Sun, 25 Mar 2012, Jason Merrill wrote: > > > As I mentioned in my patch to add -std=c++1y, I've been working on a > > proposal > > for the next standard to support return type deduction for normal > > functions, > > not just lambdas. This patch implements that proposal. > > Nice. I like the way you seem to be going for the basic, uncontroversial > version (extensions can always be discussed later), instead of trying to > figure out something universal. > > If I understand correctly, you pick the first return statement for type > deduction, and other returns (if any) are only checked afterwards for > exact consistency [...] I am not a C++ or a GCC front-end expert, but I am not sure it is the right approach for functions starting with if (!p) return nullptr; where p is a formal argument. Or perhaps I am misunderstanding what Marc is saying. I would rather suggest using all the return statements to infer the type of the function, not only the first one. Regards. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mine, sont seulement les miennes} ***