[cfe-dev] Undiagnosed "reference to stack memory [...] returned"

Eli Friedman eli.friedman at gmail.com
Wed Sep 15 13:13:38 PDT 2010


On Wed, Sep 15, 2010 at 12:58 PM, Matthieu Monrocq
<matthieu.monrocq at gmail.com> wrote:
> Therefore it seems that the proper thing to do would be to diagnose the
> issue (in both get_reference_no_warning cases) and let the developer fix
> them. I surmise it should be possible to detect them (since VC++ already
> detects the first case), but then, as I said, I am very naive about
> compilers yet.
>
> I hope to look at this further during the week-end, guess it would be as
> good a way as any to try and understand how Clang work

Yes, we should be able to diagnose both cases... the relevant code is
Sema::CheckReturnStackAddr in SemaChecking.cpp.

-Eli



More information about the cfe-dev mailing list