[cfe-dev] No uninitialized warning

Hans Wennborg hans at chromium.org
Fri Sep 28 02:59:36 PDT 2012


On Thu, Sep 27, 2012 at 8:01 PM, Pan, Wei <wei.pan at intel.com> wrote:
> Command “clang a.cpp -Weverything” reports a warning as expected for the
> following code
>
> int main() {
>    int m(m);
>   return m;
> }
>
> However,  no warning is generated for if m is declared as a reference:
>
> int main() {
>    int &m(m);
>   return m;
> }

Interesting. It does warn if you change it to "int &m = m".

> Notice that “clang a.cpp --analyze” catches this. Should “clang a.cpp
> -Weverything” catch it as well? Thanks!

Yes, I think it should. I'll take a look.

Thanks,
Hans




More information about the cfe-dev mailing list