diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2011-10-23 18:34:45 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2011-10-23 18:34:45 +0000 |
commit | 263734e172ff1d250e27ff19347077cd847d94b5 (patch) | |
tree | 968311c992d2f47134800cd82fe3d4713af460fd /gcc/doc | |
parent | 19b6a33daab2664beacb1b91e3abfa2857004278 (diff) | |
download | gcc-263734e172ff1d250e27ff19347077cd847d94b5.zip gcc-263734e172ff1d250e27ff19347077cd847d94b5.tar.gz gcc-263734e172ff1d250e27ff19347077cd847d94b5.tar.bz2 |
re PR c++/50810 (c++0x-compat does not warn about narrowing conversions)
/c-family
2011-10-23 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/50810
* c-opts.c (c_common_handle_option): Enable -Wnarrowing as part
of -Wall; include -Wnarrowing in -Wc++0x-compat; adjust default
Wnarrowing for C++0x and C++98.
* c.opt ([Wnarrowing]): Update.
/cp
2011-10-23 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/50810
* typeck2.c (check_narrowing): Adjust OPT_Wnarrowing diagnostics.
(digest_init_r): Call check_narrowing irrespective of the C++ dialect.
* decl.c (check_initializer): Likewise.
* semantics.c (finish_compound_literal): Likewise.
/testsuite
2011-10-23 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/50810
* g++.dg/cpp0x/warn_cxx0x2.C: New.
* g++.dg/cpp0x/warn_cxx0x3.C: Likewise.
2011-10-23 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/50810
* doc/invoke.texi ([-Wnarrowing], [-Wc++0x-compat]): Update.
From-SVN: r180343
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 09e115c..42f0651 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -2365,17 +2365,18 @@ an instance of a derived class through a pointer to a base class if the base class does not have a virtual destructor. This warning is enabled by @option{-Wall}. -@item -Wno-narrowing @r{(C++ and Objective-C++ only)} +@item -Wnarrowing @r{(C++ and Objective-C++ only)} @opindex Wnarrowing @opindex Wno-narrowing -With -std=c++0x, suppress the diagnostic required by the standard for -narrowing conversions within @samp{@{ @}}, e.g. +Warn when a narrowing conversion occurs within @samp{@{ @}}, e.g. @smallexample int i = @{ 2.2 @}; // error: narrowing from double to int @end smallexample -This flag can be useful for compiling valid C++98 code in C++0x mode. +This flag is included in @option{-Wall} and @option{-Wc++0x-compat}. +With -std=c++0x, @option{-Wno-narrowing} suppresses the diagnostic +required by the standard. @item -Wnoexcept @r{(C++ and Objective-C++ only)} @opindex Wnoexcept @@ -4066,7 +4067,8 @@ ISO C and ISO C++, e.g.@: request for implicit conversion from @item -Wc++0x-compat @r{(C++ and Objective-C++ only)} Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 200x, e.g., identifiers in ISO C++ 1998 that will become keywords -in ISO C++ 200x. This warning is enabled by @option{-Wall}. +in ISO C++ 200x. This warning turns on @option{-Wnarrowing} and is +enabled by @option{-Wall}. @item -Wcast-qual @opindex Wcast-qual |