On Sun, Oct 23, 2011 at 8:48 PM, Paolo Carlini <paolo.carl...@oracle.com> wrote: > Hi, > > On 10/24/2011 03:30 AM, Gabriel Dos Reis wrote: >> >> We do not use -W or -Wno- to suppressed *required* diagnostics. So, when >> -std=c++0x, -Wno-narrowing should not have any effect. > > Personally, I have no problem with this, but note, I'm not inventing > anything new here, the behavior you are discussing *pre*-dates my patch and > I feel a little nervous about changing it. If you think you can approve this > part of rhe patch, I'll change it as you want and resend.
Let me quote again the part of the patch under discussion: - /* If we're allowing C++0x constructs, don't warn about C++0x - compatibility problems. */ if (cxx_dialect == cxx0x) - warn_cxx0x_compat = 0; + { + /* If we're allowing C++0x constructs, don't warn about C++98 + identifiers which are keywords in C++0x. */ + warn_cxx0x_compat = 0; + if (warn_narrowing == -1) + warn_narrowing = 1; + } + else if (warn_narrowing == -1) + warn_narrowing = 0; + Before the patch, -std=c++0x effectively put off -Wc++0x-compat because we are compiling c++98/c++03 code, so we can only *warn* about possible compatibility conflict with C++11. However, the narrowing diagnostic required by C++11 is NOT a warning. It is a diagnostic. The way we alter a standard mandate is through some -fflag, e.g. -fpermissive. What the above patch fragment is doing is to turn on a *warning*. When -std=c++0x is in effect, narrowing is no longer a warning. It is an error by default.